J'ai développé un service d'accès distant (hébergement de type .NET dans l'ISS). IIS est configuré pour utiliser "Integrated Windows Auth". Il fonctionne parfaitement lorsque j'exécute le test unitaire du service sur le "localhost" (le code ci-dessous est le code que j'utilise pour tester), mais après avoir déployé un service sur le serveur de test (qui dans un autre domaine), il a commencé à lancer une "System.Net.WebException: Le serveur distant a renvoyé une erreur: (401) non autorisé." exception.Le serveur distant a renvoyé une erreur: (401) non autorisé dans .NET Remoting
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.
Quel pourrait être le problème? Est-ce lié au domaine? Peut-être que cela a quelque chose à voir avec une configuration du proxy Web par défaut?