/
HostNameComparisonMode.xml
160 lines (142 loc) · 9.13 KB
/
HostNameComparisonMode.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<Type Name="HostNameComparisonMode" FullName="System.ServiceModel.HostNameComparisonMode">
<TypeSignature Language="C#" Value="public enum HostNameComparisonMode" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed HostNameComparisonMode extends System.Enum" />
<TypeSignature Language="DocId" Value="T:System.ServiceModel.HostNameComparisonMode" />
<TypeSignature Language="VB.NET" Value="Public Enum HostNameComparisonMode" />
<TypeSignature Language="F#" Value="type HostNameComparisonMode = " />
<TypeSignature Language="C++ CLI" Value="public enum class HostNameComparisonMode" />
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ServiceModel.Primitives</AssemblyName>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>6.2.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Private.ServiceModel</AssemblyName>
<AssemblyVersion>4.10.3.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Enum</BaseTypeName>
</Base>
<Docs>
<summary>Specifies how the host name should be used in URI comparisons when dispatching an incoming message to a service endpoint.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The value is used to specify the URI matching rules used by transports such as HTTP, Net.Tcp, and Net.Pipe when dispatching incoming messages. Configure the value of the <xref:System.ServiceModel.HostNameComparisonMode> for a standard binding using one of the preceding transports, such as <xref:System.ServiceModel.BasicHttpBinding>, using the corresponding <xref:System.ServiceModel.HttpBindingBase.HostNameComparisonMode%2A> property. Configure the value of the <xref:System.ServiceModel.HostNameComparisonMode> for a binding element using one of the preceding transports, such as <xref:System.ServiceModel.Channels.HttpTransportBindingElement>, using the corresponding <xref:System.ServiceModel.Channels.HttpTransportBindingElement.HostNameComparisonMode%2A> property.
Each value of the <xref:System.ServiceModel.HostNameComparisonMode> corresponds to a specific type of matching rule. The sequence of matching rules attempted is always ordered as follows:
1. StrongWildcard
2. Exact
3. WeakWildcard
The first value, StrongWildcard, ignores the host name when matching and it takes the highest precedence of the three different matching modes. It is the default value for a WCF system-provided binding or binding element. This indicates that a service endpoint can be reached using any valid host name. For example, if MyService is hosted using `http://localhost/MyService`, it is still reachable using `http://www.adatum.com/MyService` because the (presumably valid) host name, "adatum.com", is ignored. Note that the port is a wildcard here as well.
The second value, Exact, requires that an exact match is found with the URI specified, including the hostname, if no strong match is found. This mode, for example, does not perform equivalence between short hostnames and fully-qualified domain names. This allows hostnames to be used as match criteria in the scenarios where multiple hosts are assigned a single IP address and it enables different services to be hosted on the same machine with distinct endpoints. Note that the port is a wildcard here as well.
The third value, WeakWildcard, matches by ignoring the hostname if no strong or exact match was found. The behavior is the same as for StrongWildcard other than the order of matching: it runs after the strong and exact bindings have been tried.
> [!NOTE]
> These values have no effect when used inside of the Internet Information Services (IIS) or Windows Process Activation Service (WAS) hosting environment. In those cases, WCF uses whatever hostname comparison mode is provided by the IIS Web Site hosting the WCF services.
## Examples
The following is an example of how to set StrongWildcard value in a service side configuration file.
Here is a basic service and client that use the preceding configuration file.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_uehostnamecomparisonmode/cs/service.cs" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_uehostnamecomparisonmode/cs/snippets.cs" id="Snippet3":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName="Exact">
<MemberSignature Language="C#" Value="Exact" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ServiceModel.HostNameComparisonMode Exact = int32(1)" />
<MemberSignature Language="DocId" Value="F:System.ServiceModel.HostNameComparisonMode.Exact" />
<MemberSignature Language="VB.NET" Value="Exact" />
<MemberSignature Language="F#" Value="Exact = 1" Usage="System.ServiceModel.HostNameComparisonMode.Exact" />
<MemberSignature Language="C++ CLI" Value="Exact" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ServiceModel.Primitives</AssemblyName>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Private.ServiceModel</AssemblyName>
<AssemblyVersion>4.10.3.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ServiceModel.HostNameComparisonMode</ReturnType>
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>Uses the hostname when dispatching incoming messages to this endpoint, if no strong match was found.</summary>
</Docs>
</Member>
<Member MemberName="StrongWildcard">
<MemberSignature Language="C#" Value="StrongWildcard" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ServiceModel.HostNameComparisonMode StrongWildcard = int32(0)" />
<MemberSignature Language="DocId" Value="F:System.ServiceModel.HostNameComparisonMode.StrongWildcard" />
<MemberSignature Language="VB.NET" Value="StrongWildcard" />
<MemberSignature Language="F#" Value="StrongWildcard = 0" Usage="System.ServiceModel.HostNameComparisonMode.StrongWildcard" />
<MemberSignature Language="C++ CLI" Value="StrongWildcard" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ServiceModel.Primitives</AssemblyName>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Private.ServiceModel</AssemblyName>
<AssemblyVersion>4.10.3.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ServiceModel.HostNameComparisonMode</ReturnType>
</ReturnValue>
<MemberValue>0</MemberValue>
<Docs>
<summary>Ignores the hostname when dispatching incoming messages to this endpoint. This is the default value.</summary>
</Docs>
</Member>
<Member MemberName="WeakWildcard">
<MemberSignature Language="C#" Value="WeakWildcard" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ServiceModel.HostNameComparisonMode WeakWildcard = int32(2)" />
<MemberSignature Language="DocId" Value="F:System.ServiceModel.HostNameComparisonMode.WeakWildcard" />
<MemberSignature Language="VB.NET" Value="WeakWildcard" />
<MemberSignature Language="F#" Value="WeakWildcard = 2" Usage="System.ServiceModel.HostNameComparisonMode.WeakWildcard" />
<MemberSignature Language="C++ CLI" Value="WeakWildcard" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ServiceModel.Primitives</AssemblyName>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Private.ServiceModel</AssemblyName>
<AssemblyVersion>4.10.3.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ServiceModel.HostNameComparisonMode</ReturnType>
</ReturnValue>
<MemberValue>2</MemberValue>
<Docs>
<summary>If no strong or exact match was found, ignores the hostname when matching.</summary>
</Docs>
</Member>
</Members>
</Type>