我一直在寻找解决此问题的方法。我一直在向我的web.config文件添加,这似乎是无助的,我已经看到了所有的建议,以便解决这个问题,而不是通过SSL工作并使用基本的http。
这是我目前的web.config:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
<bindings>
<customBinding>
<binding name="basicConfig">
<binaryMessageEncoding/>
<httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864" />
</binding>
</customBinding>
<webHttpBinding>
<binding name="Binding" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
<binding name="httpbind" crossDomainScriptAccessEnabled="true"/>
</webHttpBinding>
</bindings>
<client/>
<services>
<service name="Wcf.App.Service1" behaviorConfiguration="ServiceBehaviour">
<endpoint address="customBinding" binding="customBinding" bindingConfiguration="basicConfig" contract="Wcf.App.IService1"/>
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="REST" contract="Wcf.App.IService1"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="REST">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
大多数资源人士说要做下面的1或其他(有时两者):
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
和/或
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="REST">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
我目前在我的web.config文件中都有。
我还确保用于托管WCF RESTful Web服务的IIS 8已正确配置。再次,我搜索了很多,并确保我所做的任何建议。我目前从 Comodo 获得合法的PositiveSSL证书。 因此,解决这个问题的任何帮助都会很棒!
更新时尚
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP Tunnel to s--------a.info:443 0 chrome:1796
2 404 HTTPS s--------a.info /Service1.svc/GetData/5556932587 3,353 private text/html; charset=utf-8 chrome:1796
这就是fiddler对 HTTP :
的看法# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP s--------a.info /Service1.svc/GetData/5556932587 620 application/json; charset=utf-8 chrome:1796
但是,只需转到 HTTPS 中的Service1.svc 即可加载:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTPS s--------a.info /Service1.svc 2,939 text/html; charset=UTF-8 chrome:1796
再次更新 好吧,看起来我终于得到了正确的web.config文件,以使SSL版本能够正常工作,但现在它打破了原来的HTTP .....
<?xml version="1.0"?>
<configuration>
<appSettings/>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
<bindings>
<customBinding>
<binding name="basicConfig">
<binaryMessageEncoding/>
<httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864" />
</binding>
</customBinding>
<webHttpBinding>
<binding name="basicConfig">
<security mode="None">
<transport clientCredentialType="Basic"/>
</security>
</binding>
<binding>
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<client/>
<services>
<service name="Wcf.App.Service1" behaviorConfiguration="ServiceBehaviour">
<endpoint address="customBinding" binding="customBinding" bindingConfiguration="basicConfig" contract="Wcf.App.IService1"/>
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="REST" contract="Wcf.App.IService1"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="REST">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceBehaviour">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
</behavior>
<behavior name="REST">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
有人建议如何让两者同时工作吗?