【发布时间】:2020-04-27 08:31:33
【问题描述】:
我已经在远程桌面机器的 IIS 上部署了 WCF 服务。我可以在本地计算机的 chrome 浏览器中访问该服务,并且已将其作为服务引用添加到我的项目中。现在,当我的项目尝试访问服务时,它给了我类似 The caller was not authenticated by the service. 的错误。
在与它相关的研发之后,我在下面添加了解决方案
_client.ClientCredentials.Windows.ClientCredential.Domain = "RDP Computer name";
_client.ClientCredentials.Windows.ClientCredential.UserName = "RDP Username";
_client.ClientCredentials.Windows.ClientCredential.Password = "RDP Password";
当我再次尝试时,错误更改为 Client is unable to finish the security negotiation within the configured timeout (00:00:00). The current negotiation leg is 1 (00:00:00).
我尝试根据https://support.microsoft.com/en-in/help/17463/windows-7-connect-to-another-computer-remote-desktop-connection 的建议在 RDP 机器上查找域名。但是我在那里没有找到任何域名。它是工作组区域中可用的工作组名称。
在我的本地机器项目 app.config 文件中包含如下服务代码:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IService1">
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://xx.xx.xxx.xxx/Testing/Service1.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSDualHttpBinding_IService1">
<identity>
<servicePrincipalName value="host/RDPName" />
</identity>
</endpoint>
</client>
</system.serviceModel>
但是在 WCF 服务项目端 web.config 文件包含以下代码:
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="WcfService.Service1">
<endpoint address="" binding="wsDualHttpBinding" contract="WcfService.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<timeouts closeTimeout="00:05:00" openTimeout="00:05:00" />
</host>
</service>
</services>
<bindings>
<wsDualHttpBinding>
<binding name="customBinding0"
receiveTimeout="00:05:00"
sendTimeout="00:05:00"
openTimeout="00:05:00"
closeTimeout="00:05:00"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None">
</security>
</binding>
</wsDualHttpBinding>
</bindings>
我最近几天正在做研发以解决这个问题,但根本没有成功。
请你建议我应该怎么做才能解决这个问题?
谢谢。
【问题讨论】:
-
您可能能够通过 RDP 连接到远程计算机,因为 RDP 端口在防火墙处已打开,但您可能无法访问任何其他端口,因为防火墙可以阻止它。同样对于工作组设置,用户帐户不能跨越不同的机器。您最好通过 AD 设置域。
-
@LexLi。我尝试通过允许该端口接收传入请求来设置入站规则。但它在这种情况下不起作用。但是让我尝试设置新域名。
-
请创建一个活动目录域。这样您的服务器就能够验证 kerberos 或 NTLM 令牌。此外,您必须确保 80 端口已暴露在互联网上。我的意思是服务器门户中的服务器内部防火墙和外部防火墙墙。
-
“我尝试通过允许该端口设置入站规则”,您为 WCF 打开了哪个端口?说清楚。
标签: c# wcf iis wcf-data-services