私はリモーティング サービス (ISS で .NET タイプをホストする) を開発しました。IIS は「統合 Windows 認証」を使用するように構成されています。
「localhost」でサービスの単体テストを実行すると完全に機能します(以下のコードはテストに使用するコードです)が、テストサーバー(別の別のドメインにある)にサービスをデプロイした後、スローし始めました「System.Net.WebException: リモート サーバーがエラーを返しました: (401) Unauthorized.」例外。
string url = string.Concat(@"http://", serverName, "/", ServiceName);
IDictionary props = new Hashtable();
props["useDefaultCredentials"] = true;
props["useAuthenticatedConnectionSharing"] = true;
BinaryServerFormatterSinkProvider srv = new BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clnt = new BinaryClientFormatterSinkProvider();
this.channel = new HttpChannel(props, clnt, srv);
ChannelServices.RegisterChannel(this.channel, false);
IMyService service = Activator.GetObject(typeof(IMyService), url) as IMyService;
service.GetData();// this error returns "System.Net.WebException: The remote server returned an error: (401) Unauthorized." exception.
問題は何ですか?ドメイン関連ですか?デフォルトの Web プロキシの構成と関係があるのでしょうか?