2016-04-26 259 views
1

我看到有关此特定问题的相关问题不少。我花了一天半的时间尝试所有不同的建议。到目前为止,我还没有工作,而且我对下一步该做什么感到不知所措。因此,我呼吁在这里发现的广泛的知识基础,希望有人会看到问题并帮助我。几年前的一段时间,我在几台个人电脑前为我工作。但是当我不得不换一台新电脑时,我无法在此之后或之后开始工作,但却能够解决这个问题。现在我需要解决这个当前任务。WCF测试客户端无法添加服务 - 无法获取元数据

我在我的本地机器上运行IIS(不是IIS Express)的SOAP WCF WebService。

我创建了一个应用程序池。基本设置是集成管道模式的.NET Framework v4.0.30319。高级设置将Identity设置为ApplicationPoolIdentity。

我创建了一个网站(不使用默认的网站。)

两个绑定定义: Bindings

我们有个客户,而且我们使用的开发和QA服务自签名的证书。我已将服务证书分配给https绑定。 webservice通过net.tcp与另一个wcf服务通信。

在基本设置中,我已将物理路径定义为c:\ inetpub \ websitename。为了成功连接,使用测试设置...,我必须使用我的网络域用户标识和密码作为特定用户进行连接。我还没有找到解决办法。

在高级设置....应用程序池设置为我创建的应用程序池。物理路径是c:\ inetpub \ wwwroot \ websitename。启用协议设置为http,net.tcp。

我可以成功浏览到网站。

这里是Web服务的web.config文件:

<system.serviceModel> 
<client> 
    <endpoint address="net.tcp://10.100.13.28:8102/Acord/201307" behaviorConfiguration="NetTcpCertificatesBehavior" binding="netTcpBinding" bindingConfiguration="NetTcpCertificatesBinding" contract="AcordContract.IAcordService201307" name="AcordEndpoint"> 
    <identity> 
     <certificateReference findValue="7da522dd75f3fca2687837b7b67e117a8700ec62" isChainIncluded="false" storeLocation="LocalMachine" x509FindType="FindByThumbprint" /> 
     <!--<dns value="localhost" />--> 
    </identity> 
    </endpoint> 
    <endpoint address="net.tcp://qaschedapp:8002/IMS/201210" behaviorConfiguration="NetTcpCertificatesBehavior" binding="netTcpBinding" bindingConfiguration="NetTcpCertificatesBinding" contract="IdentityManagementContract.IIdentityManagementService201210" name="IMSEndpoint"> 
    <identity> 
     <certificateReference findValue="7da522dd75f3fca2687837b7b67e117a8700ec62" isChainIncluded="false" storeLocation="LocalMachine" x509FindType="FindByThumbprint" /> 
    </identity> 
    </endpoint> 
</client> 
<services> 
    <service name="AcordWebService.AcordWebService" behaviorConfiguration="Visible"> 

    <endpoint address="" binding="basicHttpsBinding" contract="AcordWebService.IAcordWebService201307" bindingConfiguration="BasicHttpsBinding"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://10.100.13.28:51448/" /> 
     </baseAddresses> 
    </host> 
    <!--binding for clients outside the firewall calling from C# with WCF using certs --> 
    <endpoint address="net.tcp://10.100.13.28:8122/AcordWebService.svc" binding="netTcpBinding" bindingConfiguration="NetTcpCertificatesBinding" name="NetTcpCertificatesEndpoint" contract="AcordWSContract.IAcordWSService201309"> 
     <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 
    </service> 
</services> 
<behaviors> 
    <endpointBehaviors> 
    <behavior name="NetTcpCertificatesBehavior"> 
     <clientCredentials> 
     <clientCertificate findValue="631f5a67a9a70bc78540bb809e73fd1dbd00bbeb" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" /> 
     <serviceCertificate> 
      <authentication certificateValidationMode="None" /> 
     </serviceCertificate> 
     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
    <serviceBehaviors> 
    <behavior name="Visible"> 
     <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" httpGetUrl=""/> 
     <!-- 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="true"/> 
     <serviceCredentials> 
     <serviceCertificate findValue="7da522dd75f3fca2687837b7b67e117a8700ec62" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/> 
     <clientCertificate> 
      <certificate findValue="631f5a67a9a70bc78540bb809e73fd1dbd00bbeb" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/> 
     </clientCertificate> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<bindings> 
    <basicHttpsBinding> 
    <!--binding for clients within the firewall but calling the old style soap service--> 
    <binding name="BasicHttpsBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None" /> 
     </security> 
    </binding> 
    </basicHttpsBinding> 
    <netTcpBinding> 
    <binding name="NetTcpCertificatesBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <!--<readerQuotas maxDepth="32" maxStringContentLength="65535" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />--> 
     <!--<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />--> 
     <security> 
     <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" /> 
     </security> 
    </binding> 
    </netTcpBinding> 
</bindings> 
<protocolMapping> 
    <add binding="wsHttpBinding" scheme="https" /> 
</protocolMapping>  
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

这里是尝试添加到WCF测试客户端服务时我收到完整的错误:

错误:无法从https://10.100.13.28:51448/AcordWebService.svc获取元数据如果这是您有权访问的Windows(R)Communication Foundation服务,请检查是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata上的MSDN文档Exchange Error URI:https://10.100.13.28:51448/AcordWebService.svc元数据包含无法解析的引用:'https://10.100.13.28:51448/AcordWebService.svc'。无法为权限为'10 .100.13.28:51448'的SSL/TLS安全通道建立信任关系。底层连接已关闭:无法建立SSL/TLS安全通道的信任关系。根据验证过程,远程证书无效.HTTP GET错误URI:https://10.100.13.28:51448/AcordWebService.svc下载“https://10.100.13.28:51448/AcordWebService.svc”时出错。底层连接已关闭:无法建立SSL/TLS安全通道的信任关系。根据验证程序,远程证书无效。

最后,以填补在信息几个洞: ​​

Windows Features

任何和所有帮助将不胜感激,如果我能够最终解决这个问题。

在此先感谢。

回答

1

这是我如何解决我的问题:

首先,我不得不启用日志记录在我的web.config:

<system.serviceModel> 
    <diagnostics> 
     <messageLogging maxMessagesToLog="30000" logEntireMessage="true" 
       logMessagesAtServiceLevel="true" 
       logMalformedMessages="true" 
       logMessagesAtTransportLevel="true" 
       maxSizeOfMessageToLog="65535000"> 
     </messageLogging> 
    </diagnostics> 
    </system.serviceModel> 
    <system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel" 
       switchValue="Verbose, ActivityTracing" 
       propagateActivity="true"> 
     <listeners> 
      <add name="traceListener" /> 
     </listeners> 
     </source> 
    </sources> 
    <sharedListeners> 
     <add name="traceListener" 
      type="System.Diagnostics.XmlWriterTraceListener" 
      initializeData="c:\logs\Traces.svclog" /> 
    </sharedListeners>  
    <trace autoflush="true" /> 
    </system.diagnostics> 

然后检查生成的日志我终于发现,我的web服务的构造试图初始化NLog失败。最终,我发现NLog试图写入没有权限的EventLog。我遵循here的指示,除了我授予了IIS AppPool用户的权限。这解决了我的问题。

相关问题