IChannelReceiverHook.AddHookChannelUri メソッド
チャネル フックが待機する URI を追加します。
Sub AddHookChannelUri( _
ByVal channelUri As String _)
[C#]
void AddHookChannelUri(
stringchannelUri);
[C++]
void AddHookChannelUri(
String* channelUri);
[JScript]
function AddHookChannelUri(
channelUri : String);
パラメータ
- channelUri
チャネル フックが待機する URI。
例外
例外の種類 | 条件 |
---|---|
SecurityException | 直前の呼び出し元に、インフラストラクチャ アクセス許可がありません。 |
解説
メモ クライアント コードでは、このメソッドを直接呼び出さないでください。
使用例
Class CustomChannel
Inherits BaseChannelWithProperties
Implements IChannelReceiverHook, IChannelReceiver, IChannel, IChannelSender
Public Sub AddHookChannelUri(ByVal channelUri As String) _
Implements IChannelReceiverHook.AddHookChannelUri
If Not (channelUri Is Nothing) Then
Dim uris As String() = dataStore.ChannelUris
' This implementation only allows one URI to be hooked in.
If uris Is Nothing Then
Dim newUris(1) As String
newUris(0) = channelUri
dataStore.ChannelUris = newUris
wantsListen = False
Else
Dim msg As String
msg = "This channel is already listening for data, and " + _
"can't be hooked into at this stage."
Throw New System.Runtime.Remoting.RemotingException(msg)
End If
End If
End Sub
' The rest of CustomChannel's implementation.
[C#]
class CustomChannel : BaseChannelWithProperties, IChannelReceiverHook,
IChannelReceiver, IChannel, IChannelSender {
public void AddHookChannelUri(string channelUri) {
if (channelUri != null) {
string [] uris = dataStore.ChannelUris;
// This implementation only allows one URI to be hooked in.
if (uris == null) {
string [] newUris = new string[1];
newUris[0] = channelUri;
dataStore.ChannelUris = newUris;
wantsToListen = false;
} else {
string msg = "This channel is already listening for " +
"data, and can't be hooked into at this stage.";
throw new System.Runtime.Remoting.RemotingException(msg);
}
}
}
// The rest of CustomChannel's implementation.
[C++]
__gc class CustomChannel : public BaseChannelWithProperties, public IChannelReceiverHook,
public IChannelReceiver, public IChannel, public IChannelSender
{
public:
void AddHookChannelUri(String* channelUri)
{
if (channelUri != 0)
{
String* uris __gc[] = dataStore->ChannelUris;
// This implementation only allows one URI to be hooked in.
if (uris == 0)
{
String* newUris __gc[] = new String*[1];
newUris->Item[0] = channelUri;
dataStore->ChannelUris = newUris;
wantsToListen = false;
}
else
{
String* msg = S"This channel is already listening for data, and can't be hooked into at this stage.";
throw new System::Runtime::Remoting::RemotingException(msg);
}
}
}
// The rest of CustomChannel's implementation.
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- SecurityPermission (インフラストラクチャ コードを操作するために必要なアクセス許可)要求値: SecurityAction.LinkDemand; アクセス許可値: SecurityPermissionFlag.Infrastructure
参照
IChannelReceiverHook インターフェイス | IChannelReceiverHook メンバ | System.Runtime.Remoting.Channels 名前空間