我正在将我的SL5应用程序从http切换到https,我遇到了WCF服务的问题。
那些使用自定义绑定的人工作正常但不是那些使用basichttpbinding的人。
为什么?
ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyBindingName" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
<customBinding>
<binding name="CustomBinding_WebService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="../MyBasicService.svc"
binding="customBinding" bindingConfiguration="MyBindingName"
contract="ServiceContract"
name="MyBindingName" />
<endpoint address="../MyService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_WebService"
contract="ServiceContract"
name="CustomBinding_WebService" />
</client>
</system.serviceModel>
</configuration>
使用自定义绑定的服务的Web.config:
<binding name="customBinding0">
<binaryMessageEncoding />
<httpsTransport />
</binding>
<service name="WorkingCustomService">
<endpoint address="" binding="customBinding" bindingConfiguration="customBinding0" contract="WebService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
使用basichttpbinding的服务的Web.config
<binding name="basicHttpBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport"/>
</binding>
<service name="ReportService" behaviorConfiguration="ReportServiceBehavior" >
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ReportingService" contract="ReportServiceContract" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
<behavior name="ReportServiceBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
谢谢!
答案 0 :(得分:0)
好的,找到了解决方案,谢谢:configuring WCF with <services> tag
我的服务名称不符合此规则:
Your service name must be the fully qualified name (YourNamespace.YourClassName) of your service class - the class that implements your service contract
这显然不是https中的问题,但它是https中的一个。
编辑:在我的情况下,文件.svc在开发期间被移动,但是web.config中的服务名称没有更新以反映导致问题的更改。