1

我的网络服务有问题。我们没有制作网络服务,所以我们不知道真正发生了什么。起初,它可以在我们的服务器中运行,但有时它不会导致我们重新启动它。然后现在,它显示错误消息:

无法打开安全通道,因为与远程端点的安全协商失败。这可能是由于用于创建通道的 EndpointAddress 中缺少或错误指定了 EndpointIdentity。请验证 EndpointAddress 指定或暗示的 EndpointIdentity 是否正确标识了远程端点。

但是我们的网络服务甚至没有安全保障!我们的网络配置是:

<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>
4

3 回答 3

2

终于找到答案了!基本上,在我的 asp.net 应用程序 web.config 的 System.Servicemodel 中的绑定下,我应该添加:

<security mode="None"/>

它被删除了,因为我正在使用 Web 服务身份验证的代码。感谢上帝,我有多个备份!多谢你们!我会在两天后更新这个答案。

于 2014-12-12T05:30:46.507 回答
1

我们已经修复

旧代码

<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>  
于 2016-06-23T07:03:25.867 回答
0

在安全标签下,试试这个

<security mode="None">  

<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />  

<message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />  

</security>
于 2014-12-12T04:40:34.210 回答