views:

995

answers:

6

I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it.

Creating a little windows app in 3.5 as a test is able to call the web service without problems so I know it still works.

Nothing has changed in the code at all, it's just compiled as a 3.5 project instead of a 2.0 project.

For those who care what error I get back, it's this:

An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll

Additional information: The underlying connection was closed: An unexpected error occurred on a receive.

Is there anything I can do to the web service to make it backwards compatible (if that's even the issue)?

[Edit] Responses to answers below (so far): Re-Discovering did not work, nor did removing and re-adding the webservice. I don't believe it's a SOAP issue becuase the WSDLs are identical (both show SOAP 1.2). Browsing to the webservice from the server works just fine.

+1  A: 

Try 'rediscover' the web service in .NET 1.1 (possibly just a test app) and see if the problem persists.

leppie
This did not resolve the issue. I even tried removing the reference and re-adding the web reference and the issue still persists.Thanks anyways!
Chris Conway
A: 

Can you go the the web service directly on the IIS installation? If not, check the application configuration in IIS. You must switch the version of ASP.NET.

Greg Ogle
Yes, browsing to the web service is fine. I can execute each of the methods from the server via the asmx interface.
Chris Conway
+1  A: 

It might be SOAP 1.0 versus SOAP 1.1. The 3.5 service is probably using 1.1 or 1.2, by default, which I think could be configured in the web.config bindings.

Pete
The wsdls are identical from the original web service to the new web service. I don't believe this is the issue.Thanks anyways!
Chris Conway
A: 

As an additional "sanity check", can the 3.5 web service be successfully called by soapUI?

J c
Can the 1.1 app successfully invoke a web service made in 3.5 that wasn't upgraded? For example, make a new 3.5 web service, add a HelloWorld method that returns a string, and see if you can invoke that from the 1.1 app without an error.
J c
+1  A: 

It might be a problem with KeepAlives (e.g., through a proxy). As a test, add the code below to generated Reference.cs in the client (ugly -- yes). I've seen the problem when using Fiddler (which is a proxy) to test communication between the client and the server.

    // Put this override in the generated Reference.cs of the client proxy
    protected override System.Net.WebRequest GetWebRequest(Uri uri)
    {
        HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);

        webRequest.KeepAlive = false;
        webRequest.ProtocolVersion = HttpVersion.Version10;
        return webRequest;
    }
dpp
I tried this, but this didn't help either.
Chris Conway
A: 

I encountered this and solved it by forcing domain creds on the service.

[webservice].Credentials = System.Net.CredentialCache.DefaultCredentials;

OR

[webservice].Credentials = new System.Net.NetworkCredential([user], [pwd], [domain]);

Austin Hayward