[Mono-dev] Simple web service test with windows authentication

marcos b marcosb at internet.com.uy
Wed Nov 26 12:39:41 EST 2008


I'm trying to do a web service invocation using mono. The web service is
hosted on my machine using iis. Windows authentication is used in the
web.config and in iis.
The test runs ok using .net environment but throws an Unauthorized exception
when using mono.

I don't know if this is a bug or I'm missing something...

Thanks in advance

        [Test]
        public void WebServiceTest()
        {
            WS.Service1 s=new app.WS.Service1();
            //s.UseDefaultCredentials = true;    //Also throws an exception
            //s.Credentials = CredentialCache.DefaultCredentials;  //Also
throws an exception
            s.Credentials = new NetworkCredential("myLogin", "12345678",
"myDomain");
            Assert.AreEqual(s.Add(3,5),8);
        }

Exception
detail-----------------------------------------------------------------------------

TestCase 'app.MonoWebTests.WebServiceTest'
failed: System.Net.WebException : The request failed with HTTP status 401:
Unauthorized
	at System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse
(System.Net.WebResponse response,
System.Web.Services.Protocols.SoapClientMessage message,
System.Web.Services.Protocols.SoapExtension[] extensions) [0x00000] 
	at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
(System.String method_name, System.Object[] parameters) [0x00000] 
	at app.WS.Service1.Sumar (Int32 a, Int32 b) [0x00000] 
	at (wrapper remoting-invoke-with-check) app.WS.Service1:Sumar (int,int)
	at app.MonoWebTests.WebServiceTest () [0x00000] 
	at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(object,object[],System.Exception&)
	at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000] 

-- 
View this message in context: http://www.nabble.com/Simple-web-service-test-with-windows-authentication-tp20705699p20705699.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list