Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net WCF安全协商例外_Vb.net_Wcf_Security_Wshttpbinding_Self Hosting - Fatal编程技术网

Vb.net WCF安全协商例外

Vb.net WCF安全协商例外,vb.net,wcf,security,wshttpbinding,self-hosting,Vb.net,Wcf,Security,Wshttpbinding,Self Hosting,我正在从事一项WCF服务,诚恳地说,我是新手,我一直在假装做一项具有消息安全性、自托管和使用wsHttpBinding的服务 我得到了下一个例外: System.ServiceModel.Security.SecurityNegotiationException:无法打开安全通道,因为与远程终结点的安全协商失败。这可能是由于用于创建通道的EndpointAddress中缺少EndpointIdentity或未正确指定EndpointIdentity造成的。请验证EndpointAddress指定

我正在从事一项WCF服务,诚恳地说,我是新手,我一直在假装做一项具有消息安全性、自托管和使用wsHttpBinding的服务

我得到了下一个例外:

System.ServiceModel.Security.SecurityNegotiationException:无法打开安全通道,因为与远程终结点的安全协商失败。这可能是由于用于创建通道的EndpointAddress中缺少EndpointIdentity或未正确指定EndpointIdentity造成的。请验证EndpointAddress指定或暗示的EndpointIdentity是否正确标识远程端点。-->System.ServiceModel.FaultException:安全令牌请求包含无效或格式错误的元素

这是服务器端的配置文件:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <system.diagnostics>

    <sources>
      <!-- En esta seccin se define la configuracin del registro para My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog" />
          <!-- Quite los comentarios de la seccin posterior para escribir en el registro de eventos de la aplicacin -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>

    <switches>
      <add name="DefaultSwitch" value="Information" />
    </switches>

    <sharedListeners>
      <add name="FileLog"
           type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
           initializeData="FileLogWriter" />
      <!-- Quite los comentarios de la seccin posterior y reemplace APPLICATION_NAME con el nombre de su aplicacin para escribir en el registro de eventos de la aplicacin -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
  </system.diagnostics>

  <system.serviceModel>
    <bindings>

      <wsHttpBinding>
        <binding name="wsHttpEndpointBinding">
          <security>
            <message clientCredentialType="Certificate" />
          </security>
        </binding>
        <binding name="wsBehavior" closeTimeout="00:01:00"
                 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                 bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                 maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                 allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
                           enabled="false" />
          <security mode="Message">
            <message clientCredentialType="Certificate" negotiateServiceCredential="true" establishSecurityContext="true"  />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <services>
      <service name="WCFServiceCertificate.Service1" behaviorConfiguration="WCFServiceCertificate.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="http://localhost/RHCloud.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
                  contract="WCFServiceCertificate.IService1">
          <!--
              Upon deployment, the following identity element should be removed or replaced to reflect the
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity
              automatically.
          -->
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <client><!--risq.dyndns.biz-->
      <endpoint address="http://localhost/RHCloud.svc/A" binding="wsHttpBehavior"
                bindingConfiguration="wsBehavior" contract="ServicioRH.IAvisos"
                name="ServiceAvisos" behaviorConfiguration="CustomBehavior">
        <identity>
          <dns value="WCFServer" />
        </identity>
      </endpoint>

      <endpoint address="http://localhost/RHCloud.svc/P" binding="wsHttpBehavior"
                bindingConfiguration="wsBehavior" contract="ServicioRH.IPersonal"
                name="Servicepersonal" behaviorConfiguration="CustomBehavior">
        <identity>
          <dns value="WCFServer" />
        </identity>
      </endpoint>
    </client>

    <behaviors>

      <serviceBehaviors>
        <behavior name="WCFServiceCertificate.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceCredentials>
            <clientCertificate>
              <authentication certificateValidationMode="PeerTrust" />
            </clientCertificate>
            <serviceCertificate findValue="WCFServer"
                                storeLocation="CurrentUser"
                                storeName="My"
                                x509FindType="FindBySubjectName" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="CustomBehavior">
          <clientCredentials>
            <clientCertificate findValue="WCFClient" x509FindType="FindBySubjectName" storeLocation="CurrentUser"
                               storeName="My" />
            <serviceCertificate>
              <authentication certificateValidationMode="PeerTrust" />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>

    </behaviors>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
</configuration>

你看见了吗?我当然看见了!那对我没有帮助!感谢您的回复,连接WCF可能是棘手的,而不是棘手的,它是混乱的!我绝望了!几天后我就明白了。我现在无法联系,因为我不记得我做了什么来解决这个问题。如果有人遇到这样的问题,请问我