我已经通过几乎所有关于我能找到的类似问题的答案/建议,并且他们都变得更糟,因为他们打破了http / https,我看起来似乎缺少一些非常隐藏的东西(可爱的WCF)到目前为止我无法弄明白。
W2012R2上的IIS 8.5,VS2012
症状:
- 可以在http / https根目录上浏览一个简单的hello html页面
- 可以在http / https上列出svc和svc?wdsl所有酷的
- 可以通过http调用任何方法一切都很好
- 使用下面的web配置通过https调用方法给我:
500错误:Sendera:DestinationUnreachable包含To&#39; https://<mypath&gt; /&lt; MySvc&gt; .svc / method&#39;由于EndpointDispatcher上的AddressFilter不匹配,无法在接收器处理。检查发件人和收件人的EndpointAddresses是否一致。
这是我的web.config
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Methods.MySvc" behaviorConfiguration="ServiceBehaviour">
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="webHttpBinding" contract="Methods.IMySvc" behaviorConfiguration="web" />
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="secureHttpBinding"
behaviorConfiguration="web" <<<<<< single MISING line!!!
contract="Methods.IMySvc"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- serviceMetadata httpsGetEnabled="true"/ -->
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<!-- serviceHostingEnvironment aspNetCompatibilityEnabled="true"/ -->
</system.serviceModel>
<system.webServer>
<!-- modules runAllManagedModulesForAllRequests="true"/ -->
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd"/>
</handlers>
</system.webServer>
</configuration>
更新:我自己回答,深入挖掘后我发现必须将webHttp端点行为添加到配置文件中以使https通过,就像我只是错过了一点点bity thingie,所以我的配置现在已经丢失了,而且一切都很好。