Web 服务终结点标识错误
本文关键字:标识 错误 结点 服务 Web | 更新日期: 2023-09-27 18:34:04
我的网络服务有问题。我们没有制作网络服务,所以我们不知道到底发生了什么。起初,它在我们的服务器中工作,但有时它不起作用,这会导致我们重新启动它。那么现在,它显示错误消息:
无法打开安全通道,因为与远程终结点的安全协商失败。这可能是由于用于创建通道的端点地址中缺少或错误地指定了端点身份。请验证端点地址指定或暗示的端点标识是否正确标识了远程端点。
但是我们的网络服务甚至不安全!我们的网络配置是:
<configuration>
<connectionStrings>
<add name="DefaultConnection" connectionString="Server=;Database=;User ID=;Password=;Trusted_Connection=False;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="3600000" maxRequestLength="102400" />
</system.web>
<appSettings>
<add key="baseAddress" value="http://localhost:20088" />
<add key="timeout" value="120"/>
<add key="provider" value="System.Data.SqlClient" />
</appSettings>
<system.serviceModel>
<services>
<service name="H2WcfService.DataAccess" behaviorConfiguration="H2WcfServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:20088"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="H2WcfService.IDataAccess" bindingConfiguration="DataAccess">
<identity>
<dns value="localhost:20088"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="H2WcfService.LoginService" behaviorConfiguration="H2WcfServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:20088"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="H2WcfService.ILoginService" bindingConfiguration="Authentic">
<identity>
<dns value="localhost:20088"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="H2WcfService.LMSService" behaviorConfiguration="H2WcfServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:20088"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="H2WcfService.ILMSService" bindingConfiguration="LMSService">
<identity>
<dns value="localhost:20088"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="H2WcfServiceBehavior" >
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<wsHttpBinding>
<binding name="DataAccess" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>
</binding>
<binding name="Authentic">
<security mode="None">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>
</binding>
<binding name="LMSService">
<security mode="None">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
终于找到了答案!基本上,在我的 asp.net 应用程序web.config的System.Service模型中的绑定下,我应该添加:
<security mode="None"/>
它被删除了,因为我正在使用用于 Web 服务身份验证的代码。感谢上帝,我有多个备份!谢谢大家!我将在两天后更新此问题。
我们已经修复了
旧代码
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>
新代码
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false" />
</security>
在安全标记下,试试这个
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
</security>