【问题标题】:WCF: Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8733/'WCF:元数据包含无法解析的引用:'net.tcp://localhost:8733/'
【发布时间】:2017-10-22 19:58:00
【问题描述】:

将 serviceAuthorization 添加到配置文件后,出现问题。向项目添加服务时,它看不到 netTcp 连接。没有 serviceAuthorization 一切正常。

配置:

<system.serviceModel>
        <services>
          <service behaviorConfiguration="mexBehavior" name="ChartServices.Service.ChartManagerService">
           
<endpoint address="ChartServices" binding="wsHttpBinding" bindingConfiguration="wsBindingConfig"
              name="wsBinding_UserService" contract="ChartServices.Services_Contract.IUserService" />                      
<endpoint address="ChartServices" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig"
              name="netTcp_UserService" contract="ChartServices.Services_Contract.IUserService" />                  
<endpoint address="mex" binding="mexTcpBinding" name="mexTcp"
              contract="IMetadataExchange" />           
<endpoint address="mex" binding="mexHttpBinding" name="mexHttp"
              contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:8733/" />
                <add baseAddress="http://localhost:8734/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="wsBindingConfig">
              <security mode="Message">
                <message clientCredentialType="UserName"/>
              </security>
            </binding>
          </wsHttpBinding>
          <netTcpBinding>
            <binding name="netTcpBindingConfig">
              <security mode="Message">
                <message clientCredentialType="UserName"/>
              </security>
            </binding>
          </netTcpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="mexBehavior">
              <serviceMetadata httpGetEnabled="True"/>
              <serviceDebug includeExceptionDetailInFaults="false" />
              <serviceCredentials>
                <clientCertificate>
                  <authentication certificateValidationMode="PeerTrust" />
                </clientCertificate>
                <serviceCertificate findValue="RootCATest" storeLocation="LocalMachine"
                  storeName="My" x509FindType="FindByIssuerName" />
                <userNameAuthentication userNamePasswordValidationMode="Custom"
                  customUserNamePasswordValidatorType="ChartServices.CustomUserNameValidator, ChartServices" />
              </serviceCredentials>
              <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="ChartServices.MyServiceAuthorizationManager, ChartServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
                <authorizationPolicies>
                  <add policyType="ChartServices.AuthorizationPolicy, ChartServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
                </authorizationPolicies>
              </serviceAuthorization>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

尝试了不同的选项,但无法解决问题

【问题讨论】:

    标签: c# wcf wcf-security


    【解决方案1】:

    Visual Studio 2017 问题!!!!!!

    https://github.com/dotnet/wcf/issues/1741

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-08
      • 1970-01-01
      相关资源
      最近更新 更多