通过HTTPS进行wsHTTP绑定会导致错误400'错误请求'

时间:2012-04-13 08:06:53

标签: vb.net wcf https wcf-binding bad-request

我一直在尝试创建一个简单的服务,允许通过WCF将消息记录到远程服务器上,这一切都正常,直到我将服务发布到使用HTTPS的实时环境。

经过一番搜索后,我发现我需要更改ServiceConfig以考虑不同的协议。我使用了这两篇文章的组合:

  1. How to configure WCF services to work through HTTPS without HTTP binding?
  2. WCF Bindings needed for HTTPS
  3. 对我的配置进行了推荐的更改后,我似乎处于可以在VS2010中将实时服务添加为WCF参考的状态,但是当我使用IE浏览服务或mex地址时,我'我一直收到“HTTP 400错误请求”错误。

    在使用服务方面,我似乎可以成功运行它,但是mex只是不想通过IE工作。

    服务本身托管在运行IIS 6.0的Windows Server 2003 R2 Standard Edition SP2上,没有负载平衡。

    我现在真的很茫然,我花了3-4天时间搞乱这个但我似乎无法取得任何进展。所以任何帮助都将不胜感激。

    请参阅下面的服务器服务配置:

      <system.serviceModel> 
        <services>
          <service name="mycorp.Callback.SecPayService" behaviorConfiguration="mycorp.Callback.SecPayServiceBehavior">
             <endpoint address="https://myserver.co.uk/SecPay/SecPayService.svc"
                       binding="wsHttpBinding" bindingConfiguration="TransportBinding" 
                       contract="mycorp.Callback.ISecPayService"/>      
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />        
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="mycorp.Callback.SecPayServiceBehavior">
              <serviceMetadata httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <wsHttpBinding>
            <binding name="TransportBinding">
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
      </system.serviceModel>
    

1 个答案:

答案 0 :(得分:2)

如果您在IIS中托管服务,那么只需将端点元素地址值设置为空字符串,因为端点的地址由IIS分配

相关问题