我想在web服务上实现wsHTTPBinding,但是我不断地收到这样的错误:“调用者没有被服务身份验证”。我已经看到了很多关于这个主题的帖子,但它们要么没有解决我的问题/与我的配置无关,要么‘答案’是使用basicHTTPBinding。该服务托管在具有自己的ssl证书的安全网站的根文件夹中。我希望能够使用该证书来合理地保护SOAP消息,这就是为什么我想坚持使用wsHTTP。然而,我尝试过修改各种配置--甚至设置身份验证模式为'none‘--只是为了让它正常工作--但是每次我都会遇到相同的错误。有人知道我如何修改web.config设置以使wsHTTPBinding使用现有的ssl证书工作吗?
Web.config
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<trust level="Full"></trust>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="xxxService1.xxx1Behavior" name="xxxService1.xxx1">
<endpoint address=""
binding="basicHttpBinding"
contract="xxxService1.Ixxx1"
bindingConfiguration="secureHttpBinding"
>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="xxxService1.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="xxxService1.xxx1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime version="v4.0.20506"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://111.111.111.111/xxxAPI/xxx1.svc"
binding="basicHttpBinding"
contract="TestingxxxService1.Ixxx1"
name="BasicHttpBinding_Ixxx1"
bindingConfiguration="secureHttpBinding" />
</client>
</system.serviceModel>
</configuration>发布于 2014-11-11 06:45:31
您需要发布您的客户端和服务器配置。配置取决于您需要用于身份验证的凭据。要在HTTP绑定(BasicHttpBinding或WsHttpBinding)上使用SSL,安全模式将是传输或TransportWithMessageCredential。为什么你需要WsHttpBinding来做这个?
这里有许多不同的配置选项:http://msdn.microsoft.com/en-us/library/ms789011%28v=vs.110%29.aspx
举个例子:
<wsHttpBinding>
<binding name="WsHttpBinding_ICalculator">
<security mode="TransportWithMessageCredential" >
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>发布于 2014-11-16 07:14:49
这里的问题是,我正在测试我们尚未迁移到的新站点上的服务。因此,该站点仅由IP地址而不是域标识。来自旧站点的SSL证书表明,我在我们的web托管服务端口将技术转移到了新站点,该证书拒绝了通信,因为很明显,请求来自它不承认的IP的资源。我通过将服务转移到现有的站点进行测试来“解决”了这个问题。请注意,如果您以这种方式访问web服务,则必须记住IIS中的启用SSL。
请参阅我的配置文件中的端点元素:终结点address="https://111.111.111.111/xxxAPI/xxx1.svc"
它必须是:终结点address="https://www.mysite.com/xxxAPI/xxx1.svc"
https://stackoverflow.com/questions/26852113
复制相似问题