通过HTTPS的wsHTTPBinding导致错误400“错误请求" [英] wsHTTPBinding over HTTPS causes Error 400 'Bad Request'

查看:116
本文介绍了通过HTTPS的wsHTTPBinding导致错误400“错误请求"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试创建一个简单的服务,以允许通过WCF将消息记录到远程服务器上,直到我将服务发布到使用HTTPS的实时环境后,所有这些都可以正常工作.

I've been trying to create a simple service to allow messages to be logged onto a remote server via WCF, which all worked fine until I published the service to the live environment, which uses HTTPS.

经过一些搜索,我发现我需要更改ServiceConfig来说明不同的协议.我结合使用了这两篇文章:

After some searching, I found that I needed to change my ServiceConfig to account for the different protocol. I used a combination of these two articles:

  1. 如何配置WCF服务在没有HTTP绑定的情况下通过HTTPS工作?
  2. 需要WCF绑定用于HTTPS
  1. How to configure WCF services to work through HTTPS without HTTP binding?
  2. WCF Bindings needed for HTTPS

已经对我的配置进行了建议的更改,我似乎处于一种状态,可以在VS2010中将实时服务添加为WCF引用,但是当我使用IE浏览到该服务或mex地址时,我m持续收到"HTTP 400错误请求"错误.

Having made the recommended changes to my config, I seem to be in a state where I can add the live service as a WCF reference in VS2010, but when I use IE to browse to the service or the mex address, I'm consistently receiving an 'HTTP 400 Bad Request' error.

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

In terms of using the service I can seem to run it successfully but the mex just doesn't want to work through IE.

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

The Service itself is being hosted on Windows Server 2003 R2 Standard Edition SP2 Running IIS 6.0 with no load balancing.

我现在真的很茫然,我花了3-4天时间来解决这个问题,但是我似乎没有任何进展.因此,任何帮助将不胜感激.

I'm really at a loss at this point, I've spent 3-4 days messing around with this but I can't seem to make any progress. So any help would be greatly appreciated.

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

See below the Server service config in question:

  <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>

推荐答案

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

If you are hosting your service in IIS then just have the endpoint elements address value to empty string as the address for the endpoint is assigned by IIS

这篇关于通过HTTPS的wsHTTPBinding导致错误400“错误请求"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆