locked
Errors consuming .NET 4.5 ASMX service from .NET 2.0 ASP.NET web application RRS feed

  • Question

  • User294538619 posted

    I have a web project that contains multiple ASMX web services. These services are consumed by an ASP.NET 2.0 web application project. Both are sites hosted internally within our corporate intranet and run using Windows authentication.

    I recently re-compiled the web services project from .NET 3.5 to .NET 4.5. No other changes were made.  After deploying the changes, the ASP.NET 2.0 web application started reporting errors when trying to connect to the web services.

    • In IE8, the browser throws a "Page not able to display" error.
    • In Google Chrome (v34.0.1847.131), the service will take a considerable amount of time 60+ seconds) but will finally load. (Prior to the deployment, the web services would take 1-2 seconds to load on cold start, <1 second when cached).

    Here are the specific changes I made as part of the deployment:

    • Changed the target framework of the web services project from .NET 3.5 to .NET 4.5 and re-compiled.
    • Changed the IIS application pool to run under the .NET 4.0 run-time instead of .NET 2.0.
    • Recycled the app pool and the IIS site after re-deploying.

    Other Notes:

    • Due to project dependencies, it's not feasible to update the consuming ASP.NET web project to .NET 4.0 or higher at this time.
    • The web services are running on a Windows 2008 R2 Service Pack 1 server, running IIS 7.5.

    Any suggestions would be most appreciated.

    Thanks,
    Matt

    Thursday, May 8, 2014 9:16 AM

Answers

  • User294538619 posted

    After adding some further tracing within the web service methods, it appears that it's not an ASP.NET or ASMX issue so much as an issue with a legacy class library that was still compiled against .NET 2.0. The class library contains the Data Access Layer (DAL) and was using the .NET 2.0 Table Adapters.  Apparently, upgrading the ASMX service layer to .NET 4.5 while leaving the DAL at .NET 2.0 introduced some performance issues.

    Looks like I'll be working on converting the DAL to utilize Entity Framework as well.

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 9:59 AM

All replies

  • User-417640953 posted

    Hi mjring,

    Thank you post the issue to our forum.

    According to your description, I see you upgrade your web service from .net 3.5 to .net 4.5 version.

    And your asp.net application cannot call it anymore. For this issue, I suggest you make sure your web service can be called by client.

    Please try to input the web service file (.asmx) path to your browser and see if you can get it's WSDL like below.

    http://localhost:32259/year2014/month5/5-9/WebService1.asmx

    If you can get the WSDL from the web service, you can readd the service reference to this web service in your asp.net application.

    Hope this helps, thanks.

    Best Regards!

    Friday, May 9, 2014 3:44 AM
  • User294538619 posted
    • Yes, I'm able to navigate in both IE11 and Google Chrome to the URL of the ASMX file, and it comes up correctly.
    • Within the ASP.NET web application, we have tried to remove and re-add the service reference. It updates within the solution successfully, but continues to fail when we re-run the application.

    I also reviewed the actual WSDL being generated between the .NET 2.0 and .NET 4.5 services and they are nearly identical. The only discrepancy I found was in the re-ordering of the attributes within the <wsdl:definitions> element. (The values themselves stay the same).

    The .NET 2.0 service starts like this:

    <wsdl:definitions
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" <!-- xmlns:soap is the first attribute -->
     xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
     xmlns:tns="http://www.myserver.com/"
     xmlns:s="http://www.w3.org/2001/XMLSchema"
     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     targetNamespace="http://www.myserver.com/">

    The .NET 4.5 service starts like this:

    <wsdl:definitions
     xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
     xmlns:tns="http://www.myserver.com/"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" <!-- xmlns:soap is moved further down the list, but otherwise unchanged -->
     xmlns:s="http://www.w3.org/2001/XMLSchema"
     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     targetNamespace="http://www.myserver.com/">

    Friday, May 9, 2014 11:35 AM
  • User-417640953 posted

    Hi,

    Thanks for your back.

    There are some differences between above <wsdl:definitions>, please note it.

    #.net 2.0  targetNamespace=http://dndt.principal.com/ but .net 4.5 targetNamespace=http://www.myserver.com/

    # .net 2.0 xmlns:tns=http://dndt.principal.com/  but .net 4.5 xmlns:tns=http://www.myserver.com/

    Besides, is there any error message occurs when you call the web service from .net 2.5 client?

    Thanks.

    Regards!

    Monday, May 12, 2014 1:33 AM
  • User294538619 posted

    Sorry about that... that was me attempting to scrub the data on here to remove specifics.  In my actual code, those attributes do match up.

    The errors received from the .NET 2.0 application are mentioned in the original post. Visual Studio itself does not produce any errors.

    Monday, May 12, 2014 11:25 AM
  • User-417640953 posted

    Hello,

    Sorry to say that  I cannot figure out what caused this problem just with the simple error message.

    I suggest you enable trace in the web service and see what happened from diagnostic file.

    <system.diagnostics>
        <trace autoflush="true" />
        <sources>
            <source name="System.Web.Services.Asmx">
                <listeners>
                    <add name="AsmxTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="local.log" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId" />
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="System.Web.Services.Asmx" value="Verbose"  />
        </switches>
    </system.diagnostics>
    

    Note that tracing is only enabled when the application is fully trusted.

    http://msdn.microsoft.com/en-us/library/vstudio/bb885203(v=vs.100).aspx

    Hope that helps, thanks.

    Best Regards!

    Monday, May 12, 2014 9:18 PM
  • User294538619 posted

    After adding some further tracing within the web service methods, it appears that it's not an ASP.NET or ASMX issue so much as an issue with a legacy class library that was still compiled against .NET 2.0. The class library contains the Data Access Layer (DAL) and was using the .NET 2.0 Table Adapters.  Apparently, upgrading the ASMX service layer to .NET 4.5 while leaving the DAL at .NET 2.0 introduced some performance issues.

    Looks like I'll be working on converting the DAL to utilize Entity Framework as well.

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 9:59 AM