none
wcf 调用方未由服务进行身份验证。 RRS feed

  • 问题

  • 本机添加服务器上的wcf服务,

    运行时,弹出“调用方未由服务进行身份验证。”

     

    怎么解决呀?先谢过了。


    认真学习,不耻下问.^_^
    2011年7月12日 4:26

答案

  • 服务端配置:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    	<system.serviceModel>
    		<services>
    			<service name="Host.Services" behaviorConfiguration="ServerBehavior">
    				<endpoint
              binding="mexHttpBinding"
              contract="IMetadataExchange"
              address="mex" />
    				<endpoint address="" binding="netTcpBinding" contract="Host.IServices" bindingConfiguration="TcpBindingConfig"/>
    				<host>
    					<baseAddresses>
    						<add baseAddress="http://192.168.1.200:8800"/>
    						<add baseAddress="net.tcp://192.168.1.200:8700"/>
    					</baseAddresses>
    				</host>
    			</service>
    		</services>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="ServerBehavior">
    					<serviceDebug includeExceptionDetailInFaults="true"/>
    					<serviceMetadata httpGetEnabled="true"/>
    					<serviceCredentials>
    						<serviceCertificate findValue="WcfAbc" storeLocation="CurrentUser" storeName="Root" x509FindType="FindBySubjectName"/>
    						<clientCertificate>
    							<authentication certificateValidationMode="PeerTrust" />
    						</clientCertificate>
    					</serviceCredentials>
    				</behavior>
    			</serviceBehaviors>
    		</behaviors>
    		<bindings>
    			<netTcpBinding>
    				<binding name="TcpBindingConfig">
    					<security mode="Message">
    						<message clientCredentialType="Certificate" />
    					</security>
    				</binding>
    			</netTcpBinding>
    		</bindings>
    	</system.serviceModel>
    </configuration>
    


    客户端配置

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <netTcpBinding>
                    <binding name="NetTcpBinding_IServices" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                        hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                        maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                        maxReceivedMessageSize="65536">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <reliableSession ordered="true" inactivityTimeout="00:10:00"
                            enabled="false" />
                        <security mode="Message">
                            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                            <message clientCredentialType="Certificate" algorithmSuite="Default" />
                        </security>
                    </binding>
                </netTcpBinding>
            </bindings>
            <client>
                <endpoint address="net.tcp://192.168.1.200:8700/" binding="netTcpBinding"
                    bindingConfiguration="NetTcpBinding_IServices" contract="WcfServer.IServices"
                    name="NetTcpBinding_IServices" behaviorConfiguration="ServerBehavior">
                    <identity>
                        <certificate encodedValue="AwAAAAEAAAAUAAAAEqgbpY7MiX4SclVeOecibmI8zLkgAAAAAQAAALIBAAAwggGuMIIBXKADAgECAhBe6iUvSYm8kUiL9m9Zx/LvMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTExMTA5MDgzMjU1WhcNMzkxMjMxMjM1OTU5WjARMQ8wDQYDVQQDEwZXY2ZBYmMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOYRlVp/IdlhKY2cB/Ei3LIAn2jov++Wx/Ky3pmoSdj9n5VhkS1UPR+dI1wxaQzfyQSJpICnKM6DxfAcyY057liC/FAORA7TiTxjYnmIWzktlJOy8Dsh8P9j0QSvmLmJXimOdxXhDi5rEBPnKlqHoCoNTU8Nw4utnfzr6XEL0V3zAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAaUPjEGMOvm+rLfHKk7rWk58+wyOZut2OZoQBKnoXmn5X0TIMnfmfiLjAsUpRqeSvR9scQ6uOFR2n8mYj/mgMkA==" />
                    </identity>
                </endpoint>
            </client>
          <behaviors>
            <endpointBehaviors>
              <behavior name="ServerBehavior">
                <clientCredentials>
                  <clientCertificate findValue="WcfABC" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="Root"/>
                  <serviceCertificate>
                    <authentication certificateValidationMode="PeerTrust"/>
                  </serviceCertificate>
                </clientCredentials>
              </behavior>
            </endpointBehaviors>
          </behaviors>
        </system.serviceModel>
    </configuration>
    



    认真学习,不耻下问.^_^
    • 已标记为答案 server126 2011年12月28日 2:45
    2011年11月9日 8:44
  • 你的服务端配置是什么?使用了身份验证?


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    微软WCF中文技术论坛
    微软WCF英文技术论坛

    Windows Azure中文技术论坛

    徐班主?
    认真学习,不耻下问.^_^
    • 已标记为答案 server126 2011年12月28日 2:45
    2011年11月14日 7:37

全部回复

  • 你的服务端配置是什么?使用了身份验证?


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    微软WCF中文技术论坛
    微软WCF英文技术论坛

    Windows Azure中文技术论坛

    • 已标记为答案 server126 2011年7月23日 2:01
    • 取消答案标记 server126 2011年11月9日 8:43
    2011年7月13日 9:21
    版主
  • 服务端配置:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    	<system.serviceModel>
    		<services>
    			<service name="Host.Services" behaviorConfiguration="ServerBehavior">
    				<endpoint
              binding="mexHttpBinding"
              contract="IMetadataExchange"
              address="mex" />
    				<endpoint address="" binding="netTcpBinding" contract="Host.IServices" bindingConfiguration="TcpBindingConfig"/>
    				<host>
    					<baseAddresses>
    						<add baseAddress="http://192.168.1.200:8800"/>
    						<add baseAddress="net.tcp://192.168.1.200:8700"/>
    					</baseAddresses>
    				</host>
    			</service>
    		</services>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="ServerBehavior">
    					<serviceDebug includeExceptionDetailInFaults="true"/>
    					<serviceMetadata httpGetEnabled="true"/>
    					<serviceCredentials>
    						<serviceCertificate findValue="WcfAbc" storeLocation="CurrentUser" storeName="Root" x509FindType="FindBySubjectName"/>
    						<clientCertificate>
    							<authentication certificateValidationMode="PeerTrust" />
    						</clientCertificate>
    					</serviceCredentials>
    				</behavior>
    			</serviceBehaviors>
    		</behaviors>
    		<bindings>
    			<netTcpBinding>
    				<binding name="TcpBindingConfig">
    					<security mode="Message">
    						<message clientCredentialType="Certificate" />
    					</security>
    				</binding>
    			</netTcpBinding>
    		</bindings>
    	</system.serviceModel>
    </configuration>
    


    客户端配置

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <netTcpBinding>
                    <binding name="NetTcpBinding_IServices" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                        hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                        maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                        maxReceivedMessageSize="65536">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <reliableSession ordered="true" inactivityTimeout="00:10:00"
                            enabled="false" />
                        <security mode="Message">
                            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                            <message clientCredentialType="Certificate" algorithmSuite="Default" />
                        </security>
                    </binding>
                </netTcpBinding>
            </bindings>
            <client>
                <endpoint address="net.tcp://192.168.1.200:8700/" binding="netTcpBinding"
                    bindingConfiguration="NetTcpBinding_IServices" contract="WcfServer.IServices"
                    name="NetTcpBinding_IServices" behaviorConfiguration="ServerBehavior">
                    <identity>
                        <certificate encodedValue="AwAAAAEAAAAUAAAAEqgbpY7MiX4SclVeOecibmI8zLkgAAAAAQAAALIBAAAwggGuMIIBXKADAgECAhBe6iUvSYm8kUiL9m9Zx/LvMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTExMTA5MDgzMjU1WhcNMzkxMjMxMjM1OTU5WjARMQ8wDQYDVQQDEwZXY2ZBYmMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOYRlVp/IdlhKY2cB/Ei3LIAn2jov++Wx/Ky3pmoSdj9n5VhkS1UPR+dI1wxaQzfyQSJpICnKM6DxfAcyY057liC/FAORA7TiTxjYnmIWzktlJOy8Dsh8P9j0QSvmLmJXimOdxXhDi5rEBPnKlqHoCoNTU8Nw4utnfzr6XEL0V3zAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAaUPjEGMOvm+rLfHKk7rWk58+wyOZut2OZoQBKnoXmn5X0TIMnfmfiLjAsUpRqeSvR9scQ6uOFR2n8mYj/mgMkA==" />
                    </identity>
                </endpoint>
            </client>
          <behaviors>
            <endpointBehaviors>
              <behavior name="ServerBehavior">
                <clientCredentials>
                  <clientCertificate findValue="WcfABC" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="Root"/>
                  <serviceCertificate>
                    <authentication certificateValidationMode="PeerTrust"/>
                  </serviceCertificate>
                </clientCredentials>
              </behavior>
            </endpointBehaviors>
          </behaviors>
        </system.serviceModel>
    </configuration>
    



    认真学习,不耻下问.^_^
    • 已标记为答案 server126 2011年12月28日 2:45
    2011年11月9日 8:44
  • 你的服务端配置是什么?使用了身份验证?


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    微软WCF中文技术论坛
    微软WCF英文技术论坛

    Windows Azure中文技术论坛

    徐班主?
    认真学习,不耻下问.^_^
    • 已标记为答案 server126 2011年12月28日 2:45
    2011年11月14日 7:37
  • <bindings>
    			<netTcpBinding>
    				<binding name="TcpBindingConfig">
    					<security mode="Message">
    						<message clientCredentialType="Certificate" />
    					</security>
    				</binding>
    			</netTcpBinding>
    		</bindings>


    
    
    <security mode="Message">
    mode改为None
    2011年12月28日 2:32
  • 已经解决,是由于没有访问证书权限问题所导致的,谢谢几位的回答!
    认真学习,不耻下问.^_^
    2011年12月28日 2:45
  • 这个问题 我2009年遇到过,发过一个文章 后来博客搬家 网站关闭了,。

    现在CSDN重新搬家过来

    The caller was not authenticated...如何在XP系统为WCF设置可信任的证书


    Frank Xu Lei--谦卑若愚,好学若饥
    [老徐的网站]:http://www.frankxulei.com/

    [老徐的博客]:http://54peixun.com/Author/frankxulei
    微软WCF中文技术论坛
    微软WCF英文技术论坛

    Windows Azure中文技术论坛

    2012年6月27日 10:37
    版主