.net wsHTTPBinding身份验证错误
我想在web服务上实现wsHTTPBinding,但不断出现以下错误: “服务未对调用方进行身份验证”。我已经看过很多关于这个主题的帖子,但它们要么没有解决我的问题,要么与我的配置无关,要么“答案”是使用basicHTTPBinding。 该服务托管在安全网站的根文件夹中,并具有自己的ssl证书。我希望我可以使用该证书来合理地保护SOAP消息,这就是为什么我要坚持使用wsHTTP。然而,我尝试过修改各种配置——甚至只是为了让它工作而将身份验证模式设置为“无”——但每次都会出现相同的错误。 有人知道我如何修改web.config设置以使wsHTTPBinding使用现有ssl证书工作吗 Web.config.net wsHTTPBinding身份验证错误,.net,wcf,ssl,wshttpbinding,.net,Wcf,Ssl,Wshttpbinding,我想在web服务上实现wsHTTPBinding,但不断出现以下错误: “服务未对调用方进行身份验证”。我已经看过很多关于这个主题的帖子,但它们要么没有解决我的问题,要么与我的配置无关,要么“答案”是使用basicHTTPBinding。 该服务托管在安全网站的根文件夹中,并具有自己的ssl证书。我希望我可以使用该证书来合理地保护SOAP消息,这就是为什么我要坚持使用wsHTTP。然而,我尝试过修改各种配置——甚至只是为了让它工作而将身份验证模式设置为“无”——但每次都会出现相同的错误。 有人知
<?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>
<?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>
App.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>
<?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>
您需要发布客户端和服务器配置。配置取决于要用于身份验证的凭据。要通过HTTP绑定(BasicHttpBinding或WsHttpBinding)使用SSL,安全模式将为Transport或TransportWithMessageCredential。为什么需要WsHttpBinding来完成此任务 这里有一系列不同的配置选项: 例如:
<wsHttpBinding>
<binding name="WsHttpBinding_ICalculator">
<security mode="TransportWithMessageCredential" >
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
这里的问题是,我在我们尚未迁移到的新站点上测试服务。因此,该站点仅由IP地址标识,而不是由域标识。我让技术人员在我们的web托管服务端口将旧站点的SSL证书转移到新站点,该证书拒绝了通信,因为显然请求的是来自它无法识别的IP的资源。我通过将服务转移到现有站点进行测试“修复”了该问题。 请注意,如果以这种方式访问web服务,则必须记住在IIS中启用SSL 请参见我的配置文件中的endpoint元素: 端点地址=”https://111.111.111.111/xxxAPI/xxx1.svc“ 它需要:
端点地址=”https://www.mysite.com/xxxAPI/xxx1.svc“我在发布这篇文章后发现,是的,你是对的,我不需要wsHTTP。我不认为basicHTTP会支持ssl。我已经发布了我编辑的web和app.config,但现在我得到了“无法建立SSL/TLS安全通道与授权的信任关系”…这是自签名证书吗?