共用方式為


通道和格式子組態屬性

本主題列出並說明所有可指定給 .NET 遠端處理系統中之 IChannel 實作的組態屬性。在組態檔中宣告值時,所有值都是以字串表示,但以程式設計方式建置屬性 IDictionary 時,整數值可指定為整數 (不需引號) 或字串 (需用引號括住的值),而布林值則可指定為布林。其他所有值都是指定為字串。

如需如何在組態檔之 <channel> 項目中設定通道的詳細資訊,請參閱 如何在組態檔中設定通道。如需如何以程式設計方式設定通道的詳細資訊,請參閱 如何以程式設計方式設定通道

下表列出通道類型,並顯示它們所支援的通道屬性。

類型 支援的屬性

HttpChannel

allowAutoRedirect

bindTo

clientConnectionLimit

connectionGroupName

credentials

exclusiveAddressUse

listen

machineName

name

port

priority

proxyName

proxyPort

servicePrincipalName

suppressChannelData

timeout

unsafeAuthenticatedConnectionSharing

useAuthenticatedConnectionSharing

useDefaultCredentials

useIpAddress

HttpClientChannel

allowAutoRedirect

clientConnectionLimit

connectionGroupName

credentials

domain

machineName

名稱

password

priority

proxyName

proxyPort

servicePrincipalName

timeout

unsafeAuthenticatedConnectionSharing

useAuthenticatedConnectionSharing

useDefaultCredentials

username

HttpServerChannel

bindTo

exclusiveAddressUse

listen

machineName

name

port

priority

suppressChannelData

useIpAddress

TcpChannel

authorizationModule

bindTo

exclusiveAddressUse

impersonate

machineName

name

port

priority

rejectRemoteRequests

secure

servicePrincipalName

suppressChannelData

timeout

tokenImpersonationLevel

useIpAddress

TcpClientChannel

domain

machineName

名稱

password

priority

protectionLevel

retryCount

secure

servicePrincipalName

socketCachePolicy

socketCacheTimeout

timeout

tokenImpersonationLevel

username

TcpServerChannel

authorizationModule

bindTo

exclusiveAddressUse

impersonate

machineName

name

port

priority

protectionLevel

rejectRemoteRequests#

secure

suppressChannelData

useIpAddress

IpcChannel

authorizedGroup

connectionTimeout

name

portName

priority

secure

suppressChannelData

IpcClientChannel

connectionTimeout

name

priority

secure

IpcServerChannel

authorizedGroup

name

portName

priority

secure

suppressChannelData

下表描述一般通道屬性,並列出支援它們的通道類型。

屬性 描述 支援這個屬性的型別

名稱

字串,指定這個通道的名稱。如果未指定名稱,則會依據型別使用預設名稱:

HttpChannel:"http"

HttpClientChannel:"http client"

HttpServerChannel:"http server"

TcpChannel:"tcp"

TcpClientChannel:"tcp client"

TcpServerChannel:"tcp server"

IpcChannel:"ipc"

IpcClientChannel:"ipc client"

IpcServerChannel:"ipc server"

每個通道都必須有唯一的名稱。如果想要略過名稱,但要避免命名衝突,請將這個屬性設定為空字串 ("" 或 String.Empty)。系統會允許 name 等於 String.Empty 之任意數目的通道。呼叫 ChannelServices.GetChannel() 時,這個屬性用於擷取特定通道。如需詳細資訊,請參閱通道

HttpChannel

HttpServerChannel

HttpClientChannel

TcpChannel

TcpClientChannel

TcpServerChannel

IpcChannel

IpcClientChannel

IpcServerChannel

machineName

字串,指定與目前通道搭配使用的機器名稱。如果與伺服器通道搭配使用,則會覆寫 useIpAddress

Note注意事項

一般而言,最好使用電腦的網域名稱系統 (DNS) 名稱,但如果特定網路介面卡 (NIC) (通常是無線 NIC) 的 IP 位址經常變更,則必須將應用程式設定為使用 machineName,以讓遠端處理透過 DNS 尋找機器。不過,如果電腦名稱解析速度不合理,或電腦有多張 NIC (不論是實體或虛擬 NIC;通常使用撥接連接或 VPN 網路介面卡會有這樣的情況),則應將 machineName 屬性設定為該連接目前所使用之 NIC 的 IP 位址。

HttpChannel

HttpClientChannel

HttpServerChannel

TcpChannel

TcpClientChannel

TcpServerChannel

priority

整數,表示指派給這個通道的優先權。數字愈高表示先選來進行連接的機會愈大。預設優先權是 1,允許有負數。

HttpChannel

HttpServerChannel

HttpClientChannel

TcpChannel

TcpClientChannel

TcpServerChannel

IpcChannel

IpcClientChannel

IpcServerChannel

secure (TcpChannel)

布林值 (truefalse),指定通道上的通訊是否安全。預設值是 false。設定為 true 時,會將 tokenImpersonationLevel 屬性設定為 Identification,而將 protectionLevel 屬性設定為 EncryptAndSign。請注意,安全的 TcpClientChannel 只能連接到安全 TcpServerChannel,而不安全的 TcpClientChannel 則只能連接到不安全的 TcpServerChannel

Note注意事項

如果伺服器電腦執行的是 Windows 95、Windows 98 或 Windows Me,則不可將 TcpServerChannel 指定為 secure。

TcpChannel

TcpClientChannel

TcpServerChannel

secure (IpcChannel)

布林值 (truefalse),指定通道上的通訊是否安全。預設值是 false。設定為 true 時,會將 tokenImpersonationLevel 屬性設定為 Identification。請注意,安全的 IpcClientChannel 可連接至安全或不安全的 IpcServerChannel,而不安全的 IpcClientChannel 則只能連接至不安全的 IpcServerChannel

IpcChannel

IpcClientChannel

IpcServerChannel

protectionLevel

型別 ProtectionLevel 的值。除非 secure 屬性是設定為 true (在這種情況下,預設值為 EncryptAndSign),否則預設值為 None。必須將 secure 屬性設定為 true,才能將 ProtectionLevel 屬性設定為 None 以外的任意值。

請注意,None 是唯一與 Windows 95、Windows 98 或 Windows ME 相容的設定。

TcpClientChannel

TcpServerChannel

下表顯示可指定的用戶端通道屬性。

屬性 描述 支援這個屬性的型別

clientConnectionLimit

整數,表示可對所指定伺服器同時開啟的連接數目。預設為 2。

HttpChannel

HttpClientChannel

proxyName

字串,指定呼叫遠端伺服器時,Proxy 用戶端所使用的名稱。預設會使用用戶端電腦的主機名稱。

HttpChannel

HttpClientChannel

proxyPort

整數,指定 Proxy 用戶端用於呼叫遠端伺服器的連接埠號碼。預設會在執行階段選擇無權限的可用連接埠。

HttpChannel

HttpClientChannel

retryCount

整數,指定用戶端重試一開始失敗之遠端呼叫的次數。預設為 1。

TcpClientChannel

socketCachePolicy

SocketCachePolicy 列舉型別的成員,指定 socketCacheTimeout 是相對於通訊端的建立時間,還是相對於通訊端上的最後一次傳輸時間。預設值是 Default

TcpClientChannel

socketCacheTimeout

整數,指定從 TcpClientChannel 物件所維護之快取中移除通訊端後的時間 (以秒為單位)。預設為 5 秒。

TcpClientChannel

connectionTimeout

整數,指定等待連接順利完成的毫秒數。0 或 -1 表示無限逾時等待時間。預設值是 Infinite

IpcChannel

IpcClientChannel

timeout

整數,指定要求逾時之前等待的毫秒數。0 或 -1 表示無限逾時等待時間。預設值是 Infinite

HttpChannel

HttpClientChannel

TcpChannel

TcpClientChannel

allowAutoRedirect

布林值 (truefalse),指出是否允許自動處理伺服器重新導向。

HttpChannel

HttpClientChannel

credentials

取得或設定 ICredentials 實作,表示用戶端的識別。

HttpChannel

HttpClientChannel

useAuthenticatedConnectionSharing

布林值 (truefalse),表示伺服器通道會重複使用已驗證的連接,而非驗證每個收到的呼叫。預設情況下,如果 useDefaultCredentials 值設定為 true,則這個值也會設定為 true;其他情況下則設定為 false,這表示如果伺服器需要驗證,則會驗證每個呼叫。這也可用程式設計的方式達成,做法為建立實作 IDictionary 的物件、將 "credentials" 值設定為 CredentialCache.DefaultCredentials,再將該值傳遞給通道接收;或是使用 ChannelServices.GetChannelSinkProperties 方法所傳回的 IDictionary

只有在下列平台上的 .NET Framework 1.1 版才支援這個名稱/值組:Microsoft Windows 98、Windows NT 4.0、Windows Millennium Edition (Windows Me)、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

HttpChannel

HttpClientChannel

unsafeAuthenticatedConnectionSharing

布林 值 (truefalse),表示用戶端會提供自己的認證和連接群組名稱,供伺服器建立已驗證的連接群組。如果這個值是設定為 true,則 connectionGroupName 值只能對應至一個已驗證使用者。如果 useAuthenticatedConnectionSharing 值是設定為 true,則會忽略這個名稱/值組。

只有在下列平台上的 .NET Framework 1.1 版才支援這個名稱/值組:Windows 98、Windows NT 4.0、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

HttpChannel

HttpClientChannel

connectionGroupName

字串,如果已指定 unsafeAuthenticatedConnectionSharing 值,則指定要在伺服器上當做連接群組名稱的名稱。如果 unsafeAuthenticatedConnectionSharing 未設定為 true,則會忽略這個名稱/值組。如果已指定,請確定這個名稱只對應至一個已驗證使用者。

只有在下列平台上的 .NET Framework 1.1 版才支援這個名稱/值組:Windows 98、Windows NT 4.0、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

HttpChannel

HttpClientChannel

useDefaultCredentials

布林值 (truefalse),指定對伺服器通道進行驗證時,是否要呈現與目前執行緒相關之識別的認證。

HttpChannel

HttpClientChannel

servicePrincipalName

字串,指定 Kerberos 驗證的 servicePrincipalName。預設值為 null

HttpChannel

HttpClientChannel

TcpChannel

TcpClientChannel

tokenImpersonationLevel

型別 TokenImpersonationLevel 的值。這個屬性指定用戶端如何向伺服器進行驗證。除非 secure 屬性是設定為 true (在這種情況下,預設值為 Identification),否則預設值為 None

TcpChannel

TcpClientChannel

domain

字串,指定對伺服器通道進行驗證時,要與 username 所指定之使用者名稱和 password 所指定之密碼搭配使用的網域名稱。

HttpClientChannel

TcpClientChannel

username

字串,指定對伺服器通道進行驗證時,要與 password 所指定之密碼和 domain 所指定之網域搭配使用的使用者名稱。

HttpClientChannel

TcpClientChannel

password

字串,指定對伺服器通道進行驗證時,要與 username 所指定之使用者名稱和 domain 所指定之網域搭配使用的密碼。

HttpClientChannel

TcpClientChannel

Note注意事項

在 Windows 98 和 Windows Me 上,沒有安全性 ID 可識別驗證連接群組名稱。因此,在這些平台上,會有一個連接群組名稱。

Note注意事項

如果想要應用程式傳遞 ICredentials 實作或傳遞 HttpClientChannel 屬性中明確的 usernamepassworddomain 值,則可透過另外傳遞 unsafeAuthenticatedConnectionSharing 名稱/值組和 connectionGroupName 名稱/值組,以確保 connectionGroupName 值只對應至一個已驗證使用者的方式,啟用驗證連接共用。

下表顯示可指定的伺服器通道屬性。

屬性 描述 支援這個屬性的型別

port

整數,指定通道所要接聽的連接埠。如果指定 0,則遠端處理系統會自動選擇開放的連接埠。

HttpChannel

HttpServerChannel

TcpChannel

TcpServerChannel

suppressChannelData

布林值 (truefalse),指定通道是否會產生可從 ChannelDataChannelDataChannelData 屬性取得的通道資料。預設值是 false

HttpChannel

HttpServerChannel

TcpChannel

TcpServerChannel

IpcChannel

IpcServerChannel

useIpAddress

布林值 (truefalse),指定是否使用發行 URL 中的 IP 位址,而非使用電腦名稱。例如,在無線網路中移動可攜式電腦時,通常會切換該電腦的 IP 位址。將這個值指定為 false 會使用電腦名稱而非位址,因此在漫遊時遠端通訊並不會中斷。預設為 true。將 machineName 屬性與伺服器通道搭配使用時,可使用該屬性覆寫這個值;如需詳細資訊,請參閱 machineName 屬性。

HttpChannel

HttpServerChannel

TcpChannel

TcpServerChannel

bindTo

字串,指定伺服器通道所應繫結之網路介面卡 (NIC) 的 IP 位址。預設值為 System.Net.IPAddress.Any

HttpChannel

HttpServerChannel

TcpChannel

TcpServerChannel

listen

布林值 (truefalse),指定是否允許在 IChannelReceiverHook.WantsToListen 中攔截啟動。預設值是 true

HttpChannel

HttpServerChannel

rejectRemoteRequests

布林值 (truefalse),指定是否拒絕來自其他電腦的要求。指定 true 只會允許來自本機電腦的遠端處理呼叫。預設值是 false

TcpChannel

TcpServerChannel

exclusiveAddressUse

布林值 (truefalse),指定通道是否要阻止其他應用程式重複使用 IP 位址/連接埠組合。預設值是 true。設定為 true 時,這個屬性會將 SocketOptionName 伺服器通訊端選項設定為 SocketOptionName.ExclusiveAddressUse

只有在下列平台上的 .NET Framework 1.1 版才支援這個屬性:Windows NT 4.0 (含 Service Pack 4) 或以後版本、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

在 Windows XP Service Pack 2 或 Windows Server 2003 之前的平台上變更這個屬性需要有系統管理員權限。

HttpChannel

HttpServerChannel

TcpChannel

TcpServerChannel

impersonate

布林值 (truefalse),指定伺服器是否應模擬用戶端。預設值是 false

TcpChannel

TcpServerChannel

authorizedGroup

字串,指定有權可連接至這個通道的群組或使用者。預設為允許存取所有授權的使用者。

IpcChannel

IpcServerChannel

portName

字串,指定伺服器要公開的連接埠名稱。這對 IpcChannelIpcServerChannel 而言是必要屬性。

IpcChannel

IpcServerChannel

authorizationModule

指定實作 IAuthorizeRemotingConnection 介面之類別的組件、命名空間及類別名稱的字串。字串的格式必須是 "AuthorizationModuleNameSpace.AuthorizationModuleClass,AuthorizationModuleAssembly"。

TcpChannel

TcpServerChannel

下表顯示可指定的通道接收屬性。

屬性 描述 支援這個屬性的型別

includeVersions

布林值 (truefalse),指定格式子是否應包含版本控制資訊。

BinaryClientFormatterSink BinaryServerFormatterSink SoapClientFormatterSink SoapServerFormatterSink

strictBinding

布林值 (truefalse),指定接收格式子在只使用不含版本資訊的型別名稱和組件名稱之前,是否先嘗試使用完整的版本資訊 (如果存在的話) 識別型別。系統提供之兩個格式子的預設值都是 false。如需詳細資訊,請參閱 <formatter> 項目 (範本)

BinaryServerFormatterSink SoapServerFormatterSink

metadataEnabled

布林值 (truefalse),指定如果這個接收位在通道接收鏈結中,是否接受結尾為 "?wsdl" 的要求。預設值是 true。如果是 false,則只要有應用程式定義域中之任何物件的中繼資料的要求,接收就會擲回例外狀況。

只有在下列平台上的 .NET Framework 1.1 版才支援這個屬性:Windows 98、Windows NT 4.0、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

SdlChannelSink

remoteApplicationMetadataEnabled

布林值 (truefalse),指定是否接受物件統一資源識別元 (URI) "RemoteApplicationMetadata?wsdl" 的要求,該物件會傳回描述所有應用程式定義域所發行之物件的 Web 服務描述語言 (WSDL)。如果是 false,則任何對 "RemoteApplicationMetadata.rem" 的要求都會觸發例外狀況。但會接受特定物件 URI 的所有其他 "?wsdl" 要求。如果是 true,則會接受全域中繼資料要求。預設值是 false

只有在下列平台上的 .NET Framework 1.1 版才支援這個屬性:Windows 98、Windows NT 4.0、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

SdlChannelSink

typeFilterLevel

字串值,指定伺服器通道所嘗試的自動還原序列化層級。支援的值為 Low (預設值) 和 Full。如需還原序列化層級的詳細資訊,請參閱 .NET 遠端處理中的自動還原序列化

只有在下列平台上的 .NET Framework 1.1 版才支援這個屬性:Windows 98、Windows NT 4.0、Windows Me、Windows 2000、Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003 家族。

BinaryServerFormatterSink SoapServerFormatterSink

請參閱

工作

如何在組態檔中設定通道 
如何以程式設計方式設定通道

參考

遠端設定結構描述

概念

遠端應用程式組態
遠端物件組態
遠端物件組態