Web Services are really cool (duh!). I've been playing around a bit with them lately, and created a web service for making outbound telephone calls. It worked fine from within our network but when I posted it to a remote server as a test, I started seeing this error message:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
I was mystified but a little research soon cleared up the mystery. It seems that there is a property called "keepalive" that is enabled by default with the System.Net.WebRequest object to enable NTLM authentication. When I disabled this property, the error messages went away.
Here's a microsoft knowledgebase article that explains this in more detail:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;915599
To disable the property, the proxy class for the web service must be inherited and the webrequest method overridden as shown in this snippet from the knowledgebase article:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
I was mystified but a little research soon cleared up the mystery. It seems that there is a property called "keepalive" that is enabled by default with the System.Net.WebRequest object to enable NTLM authentication. When I disabled this property, the error messages went away.
Here's a microsoft knowledgebase article that explains this in more detail:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;915599
To disable the property, the proxy class for the web service must be inherited and the webrequest method overridden as shown in this snippet from the knowledgebase article:
Class MyTestService
Inherits TestService.TestService
Protected Overrides Function GetWebRequest(ByVal uri As Uri) As System.Net.WebRequest
Dim webRequest As System.Net.HttpWebRequest
webRequest = CType(MyBase.GetWebRequest(uri), System.Net.HttpWebRequest)
'Setting KeepAlive to false
webRequest.KeepAlive = False
GetWebRequest = webRequest
End Function
...
End Class
0 Comments:
Post a Comment
<< Home