我还有下一个问题--我尝试在我的web服务方法中使用外部程序集(Web服务在LAN中工作)。此外部程序集在其内部组件中使用TcpClient访问外部IP地址。但不幸的是。创建TcpClient失败。
System.Net.Sockets.SocketException被捕获Message=A套接字操作遇到了死网络xxx.xxx:xxxx Source=System ErrorCode=10050 NativeErrorCode=10050 StackTrace:вSystem.Net.Sockets.TcpClient..ctor(String hostname,Int32端口)
通过代理Microsoft ISA Server实现局域网对外部网络的访问。在控制台应用程序中,所有工作正常,但是web服务方法出现异常:(我试图在web.config文件中使用下一个参数:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true" >
</compilation>
<authentication mode="Windows"/>
<identity impersonate="true" userName="domain\User" password="password"/>
</system.web>
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy proxyaddress="http://isa-server:8080/" bypassonlocal="True" usesystemdefault="True" />
</defaultProxy>
</system.net>
</configuration>但也不幸的是。奇怪的是,来自WebRequest类的请求是以正常方式执行的。TcpClient类中的问题。
[WebMethod]
public string Test()
{
// This code works fine
var request = WebRequest.Create("http://www.google.ru");
var response = (HttpWebResponse)request.GetResponse();
Debug.Assert(response.StatusDescription.ToUpper() == "OK");
// But this rise exception
var a = new TcpClient("XXX.XXX.XXX.XXX", XXX).GetStream().CanRead;
}我也尝试过在web服务方法中手工模拟,但也没有结果。
new WindowsIdentity(WindowsIdentity.GetCurrent(true).Token).Impersonate();有人能帮我吗?ISA代理服务器可能存在问题,参数不正确?我看了ISA服务器日志,似乎最普通的web服务方法甚至没有进入代理服务器。可能是面临同样挑战的人。谢谢你,为我的错误英语道歉!
发布于 2011-03-19 16:15:53
从代理地址中删除尾随斜杠,如下所示
<proxy proxyaddress="http://isa-server:8080" https://stackoverflow.com/questions/5003316
复制相似问题