我有一台安装了AX2012的远程机器,在其中我已经在AX2012中构建了一个自定义服务,并且我能够在Windows控制台应用程序(VS2010)中正常使用它。但是当我尝试通过Windows控制台应用程序(VS2012)从自己的机器连接到服务时,它会给出错误“服务器拒绝客户端凭据。”
我的代码如下:
ServiceReference1.TestService1Client t = new ServiceReference1.TestService1Client();
t.ClientCredentials.UserName.UserName = "vanya";
t.ClientCredentials.UserName.Password = "*******";
t.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
ServiceReference1.CallContext c = new ServiceReference1.CallContext();
c.Company = "ussi";
ServiceReference1.EventList eventss = t.getEventItems(c, "BradPSUS", "contoso.com");
我的app.config文件中的绑定如下所示:
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_TestService1" transferMode="Buffered" />
<binding name="NetTcpBinding_ItemService" />
</netTcpBinding>
</bindings>
如果我在app.config中添加security mode = "none",就会出现以下错误:“套接字连接中止。这可能是由于处理您的消息或远程主机超时接收超时引起的错误,或底层网络资源问题。本地套接字超时为“00:00:59.9609696”“。
相同的方法在远程设备上完美运行,但在我的设备上却无法工作。我该怎么做?