调用者未通过 VM 上 WCF 服务中的服务进行身份验证
我正在尝试让客户端连接到 Windows 服务中托管的 WCF 服务。客户端运行在没有网络、没有域的计算机上,Win XP SP3。该计算机正在运行 Win XP SP3 的 VM,并且正在运行前面提到的 WCF 服务。 VM 配置为“与主机共享网络”。 2台机器可以互相ping通。
我尝试将服务作为 LocalService 运行,并在真实计算机和虚拟机上的用户帐户/密码下运行。
<?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]
" />
<param name="Footer" value="[Footer]
" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>
我在另一台具有网络连接的计算机上设置了运行虚拟机
I'm trying to get a Client to connect to a WCF Service hosted in a Windows Service. The client is running on a computer that has no network and no domain, Win XP SP3. The computer is running a VM of Win XP SP3, and has the previously mentioned WCF Service running. The VM is configured to "share network with host". The 2 machines can ping each other.
I've tried running the service as both a LocalService and running it under a user account/password that is on both the real machine and the 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]
" />
<param name="Footer" value="[Footer]
" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>
I got this set up running VMs on a different machine that does have a network connection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是,您已使用客户端的 Windows 凭据在 wsHttp 绑定上配置了消息安全性,但服务器无法识别客户端的 Windows 凭据,因为服务器的域与客户端 VM 上的本地安全机构之间不存在域信任。
如果虚拟机无法加入与服务器相同的域,您将需要更改为使用不同的凭据(例如客户端证书),或禁用消息安全性。
Your problem is that you have configured message security on your wsHttp binding, using the client's Windows credential, but the server doesn't recognise the client's Windows credential because there is no domain trust between the server's domain and the local security authority on the client VM.
If the VM cannot be joined to the same domain as the server, you will need to change to use a different credential such as a client certificate, or disable message security.