Wcf Http和Https
请帮帮我Wcf Http和Https,wcf,http,iis-7,https,Wcf,Http,Iis 7,Https,请帮帮我 <behaviors> <serviceBehaviors> <behavior name="stdHttpBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer ma
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
我的以下设置工作正常:-
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
托管在本地IIS 7网站上的WCF服务库
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
Silverlight应用程序在本地IIS 7上的网站上使用上述服务
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
我正在写的解决方案是内联网,而不是互联网,但是我的老板告诉我,它需要通过Https。我正在使用Windows身份验证
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
以下是其中一个服务终结点的配置文件块,已更改为删除公司信息等:-
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
为了试验Https,我创建了一个“自签名证书”。然后,我将https添加到默认网站绑定中,并将这两个网站更改为需要SSL,还更改了配置文件中的relvant URI。我设法让它工作,但现在我想回到标准Http,并在该模式下完成项目,因为它更容易使用。我重新更改了所有设置,并非常仔细地检查了这些设置
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
现在,如果我尝试在Silverlight项目中下载服务定义,则会出现此错误:-
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
'找不到与绑定为BasicHttpBinding的终结点的方案https匹配的基址。注册的基址方案是[http]。'
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
如果我把证书和绑定放回IIS。服务定义看起来下载正常,但是它引用了https URI,因此实际的服务调用都不能工作,因为它们是http地址
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
我尝试添加一个新的网站来托管该服务,但出现了相同的错误
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
在过去的几天里,我一直在试图解决这个问题,但找不到答案。似乎在某个地方有一个隐藏的引用,而不是在我的项目中,因为它继续在IIS中添加了一个新网站。这似乎很明显,但是您是否将windowsHttpBinding绑定配置上的安全模式更改为BasicHttpSecurityMode。无
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
相关资源:
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
这似乎很明显,但您是否已将windowsHttpBinding绑定配置上的安全模式更改为BasicHttpSecurityMode.None
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
相关资源:
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
要在基本HTTP绑定下使用HTTP上的SSL,您需要切换端点以使用传输级安全性。在您的情况下,您还需要指出客户端凭据类型:
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="windowsHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
<message />
</security>
</binding>
</basicHttpBinding>
</bindings>
要在基本HTTP绑定下使用HTTP上的SSL,您需要切换端点以使用传输级安全性。在您的情况下,您还需要指出客户端凭据类型:
<behaviors>
<serviceBehaviors>
<behavior name="stdHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="windowsHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
<message />
</security>
</binding>
</basicHttpBinding>
</bindings>
谢谢这是问题所在,但情况恰恰相反。在设置Https时,我确实将安全模式更改为Transport,但我没有将其更改回TransportWithCredential,因为我认为Http或Https都允许传输。似乎传输需要Https,因此失败,告诉您即使您没有设置Https端点,也找不到Https。谢谢。这是问题所在,但情况恰恰相反。在设置Https时,我确实将安全模式更改为Transport,但我没有将其更改回TransportWithCredential,因为我认为Http或Https都允许传输。似乎传输需要Https,因此失败了,告诉您即使您没有设置Https端点,它也找不到Https。当我使用Http安全模式传输时,只有它起作用。对于Https,我改为传输。我错误地认为Http也允许传输,并且没有将其更改回去。当我使用Http安全模式TransportwithCredential时,它只起作用。对于Https,我改为传输。我错误地认为Http也允许传输,并且没有将其更改回去。