EndpointAddress.AnonymousUri 属性
定义
获取匿名 URI 的与版本无关的表示形式。Gets a version-neutral representation of the anonymous URI.
public:
static property Uri ^ AnonymousUri { Uri ^ get(); };
public static Uri AnonymousUri { get; }
member this.AnonymousUri : Uri
Public Shared ReadOnly Property AnonymousUri As Uri
属性值
Uri具有值的 http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous 。A Uri with the value http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous.
示例
AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1);
AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2);
AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };
AddressHeaderCollection headers = new AddressHeaderCollection(addressHeaders);
EndpointIdentity endpointIdentity =
EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);
EndpointAddress endpointAddress = new EndpointAddress(
new Uri
("http://localhost:8003/servicemodelsamples/service/incode/identity"),
endpointIdentity, addressHeaders);
Uri anonUri = EndpointAddress.AnonymousUri;
注解
如果用于初始化构造函数的 URI 的值为 AnonymousUri,则 IsAnonymous 设置为 true。If the value of the URI used to initialize the constructor is the AnonymousUri, then IsAnonymous is set to true.
EndpointAddress 是一个与版本无关的类,AnonymousUri 属性会返回一个采用非特定表示形式的值。EndpointAddress is a version-neutral class and the AnonymousUri property returns a value is a neutral representation. 当您尝试将它写出或转换到某个版本时,它就会转变为该版本的适当值。When you write this out or convert this to one version or the other, then it turns into the right value for that version.
由于目前大量网络技术的广泛应用(例如 NAT、DHCP 和防火墙),许多部署都不能将一个有意义的全局 URI 分配给指定的终结点。Due to the range of network technologies currently in widespread use (for example, NAT, DHCP, and firewalls), many deployments cannot assign a meaningful global URI to a given endpoint. 为了使这些 匿名 终结点可以启动消息交换模式和接收答复,Web 服务寻址规范定义了一个 URI ,以供不能具有可解析的稳定 URI 的终结点使用。To allow these anonymous endpoints to initiate message exchange patterns and receive replies, the Web Services Addressing specification defines a URI for use by endpoints that cannot have a stable, resolvable URI.
使用此地址的请求必须提供某种机制,用以发送答复或错误(例如,在相同的传输连接上返回答复)。Requests that use this address must provide some mechanism for delivering replies or faults (for example, returning the reply on the same transport connection). 此机制可以是请求/答复传输协议(例如 HTTP GET 或 POST)。This mechanism can be a request/reply transport protocol (for example, HTTP GET or POST). 此 URI 可用作答复消息的目标位置,而不应用作其他情况的目标位置。This URI can be used as the destination for reply messages and should not be used as the destination in other circumstances.