调用方未通过VM上的WCF服务中的服务进行身份验证

时间:2011-05-26 16:03:58

标签: wcf windows-services windows-authentication

我正在尝试让客户端连接到Windows服务中托管的WCF服务。客户端运行在没有网络且没有域的计算机上,Win XP SP3。计算机正在运行Win XP SP3的VM,并且之前提到的WCF服务正在运行。 VM配置为“与主机共享网络”。这两台机器可以互相ping。

我尝试将服务作为LocalService运行,并在真实计算机和VM上的用户帐户/密码下运行。

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="DllAnalyzer.DllAnalyzerClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
      <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    <system.serviceModel>
        <client>
          <!--This is the endpoint to the VM Running the service -->
            <endpoint address="http://192.168.224.1:8001/DllAnalyzerService/"
                binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IDllAnalyzerService"
                contract="AnalyzerServiceReference.IDllAnalyzerService" name="WSDualHttpBinding_IDllAnalyzerService">
                <identity>-->
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
      <bindings>
        <wsDualHttpBinding>
          <binding name="WSDualHttpBinding_IDllAnalyzerService" closeTimeout="00:01:00"
              openTimeout="00:01:00" sendTimeout="00:01:00"
              bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
              maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
              messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            <reliableSession ordered="true" />
            <security mode="Message">
              <message clientCredentialType="Windows" negotiateServiceCredential="true"
                  algorithmSuite="Default" />
            </security>
          </binding>
        </wsDualHttpBinding>
      </bindings>
    </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><applicationSettings>
        <DllAnalyzer.DllAnalyzerClient.Properties.Settings>
            <setting name="UseSelfHostingService" serializeAs="String">
                <value>True</value>
            </setting>
        </DllAnalyzer.DllAnalyzerClient.Properties.Settings>      
    </applicationSettings>
    <log4net>
      <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
        <param name="File" value="${USERPROFILE}\DLL Analysis Logs\ClientLog.txt" />
        <param name="AppendToFile" value="true" />
        <layout type="log4net.Layout.PatternLayout">
          <param name="Header" value="[Header]&#xD;&#xA;" />
          <param name="Footer" value="[Footer]&#xD;&#xA;" />
          <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
        </layout>
      </appender>
      <root>
        <level value="DEBUG" />
        <appender-ref ref="LogFileAppender" />
      </root>
    </log4net>
</configuration>

我让这个设置在具有网络连接的另一台机器上运行虚拟机

1 个答案:

答案 0 :(得分:1)

您的问题是您已使用客户端的Windows凭据在wsHttp绑定上配置了邮件安全性,但服务器无法识别客户端的Windows凭据,因为服务器的域与本地安全机构之间没有域信任。客户端VM。

如果VM无法加入与服务器相同的域,则需要更改为使用其他凭据(如客户端证书)或禁用邮件安全性。