IPv6 和 SoapTcpTransport.GetInputChannel (WSE)
题
我在获取 IPv6 地址与 .NET WSE SoapTcpTransport.GetInputChannel 或更具体地说 SoapReceivers.Add(它在幕后使用 GetInputChannel)一起使用时遇到问题。由于这个星球上似乎没有其他人遇到这个问题,我认为我做错了什么。
如果我使用 IPv4 地址和端口 (soap.tcp://192.168.0.198:9063) 创建 SOAP 输入通道,那么一切似乎都很好。当我对同一网络适配器使用 IPv6 地址 (soap.tcp://[fe80::c450:7142:67f5:ad66%11]:9063) 时,SoapTcpTransport.GetInputChannel 会引发异常:“系统.ArgumentException:WSE813:以下传输地址无法映射到本地网络接口:soap.tcp://[FE80:0000:0000:0000:C450:7142:67F5:AD66]:9063/..”
两者之间的唯一区别是 Uri 是使用 IPv4 或 IPv6 地址创建的。两个地址都会响应 ping。对于 Microsoft.Web.Services2 和 3,此行为是相同的。我有一个 MS 单元测试可以重现该问题:
[TestMethod]
public void ShouldConstructInputChannelWithIpv6Address_Selfcontained()
{
Uri via = new Uri("soap.tcp://[fe80::c450:7142:67f5:ad66%11]:9063");
EndpointReference receiveEndpoint = new EndpointReference(via);
SoapTcpTransport soapTransport = new SoapTcpTransport();
ISoapInputChannel inputChannel = soapTransport.GetInputChannel(receiveEndpoint, SoapChannelCapabilities.ActivelyListening);
inputChannel.Close();
Assert.IsTrue(true); // If it makes it this far without an exception, then that's progress.
}
我问过这个 MSDN 论坛上有同样的问题.
解决方案
我道歉。我不知何故错过了你的问题。我在ASMX论坛上回答过:
只想确认一下:你知道“WSE 已过时 - 仅在必要时使用"?
不隶属于 StackOverflow