none
After Upgrading to VS2012, Application no longer works in Production RRS feed

  • Question

  • After upgrading to VS2012, our application no longer works in production. The error is:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    When we go back to the older version of the deployment package, the application works again.

    It isn't our firewall because nothing changed there and, like I said, when we revert to the previous version built under VS2010, the application works.

    We use Entity Framework and use the application pool to provide authentication to SQLServer. SQLServer is on a separate dedicated machine.

    What could the issue be? Thanks for any and all help.

    Eric

    Thursday, November 8, 2012 11:19 PM

Answers

  • Found the solution. Our SA installed the 32-bit sql client and it started working again. 

    Now the question is why that is needed and not the 64-bit version that worked under VS2010.

    Tuesday, November 13, 2012 7:43 PM
  • We got everything to work following these instructions:

    1. Change the alias name from CIH[env] to CIHDB (so that we will no longer have to update the connection string after each update by having all environments using matching parameters)
        a. Start > Run > cliconfg.exe
        b. Under the Alias tab, Edit the alias
            i. Rename CIH[env] to CIHDB
    
    2. Create a 32 bit alias matching the 64 bit alias to support Visual Studio 2012
        a. Run c:\windows\syswow64\cliconfg.exe (this is the 32 bit version)
        b. Under the General tab, enable TCP/IP
        c. Under the Alias tab, Add an alias with the following:
            i. Name:  CIHDB
            ii. Network libraries:  TCP/IP
            iii. Server name:  CIH[env]DB\CIH[env]
            iv. Port:  [check the 64 bit alias for the correct port]

    • Marked as answer by Eric Coffman Monday, December 3, 2012 8:14 PM
    Monday, December 3, 2012 8:14 PM

All replies

  • Hi Eric,

    Welcome to the MSDN Forum.

    >>It isn't our firewall because nothing changed there and, like I said, when we revert to the previous version built under VS2010, the application works.

    Based on your description, I think the point is "nothing changed".

    When you rebuild it in VS2012, this application becames a new application which is different the one you built it in VS2010. So the firewall block the new application to connect the to network. 

    So I suggest you to add this new version to the white list.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 9, 2012 2:17 PM
    Moderator
  • Mike,

    thanks for the reply. I just asked our SA and he has told me that there are no outbound firewall rules configured.

    But he said he will try to see if it is actually trying to make a connection to the network.

    Mike, if this doesn't work, do you have any suggestions what I should do to get this figured out? Being new to VS and Windows, this is tough.

    Thanks

    Eric

    Friday, November 9, 2012 2:44 PM
  • Hi Eric,

    Based on the error message, the problem should be the connection party. I mean, your application cannot connect to the sql server.

    You can also try this similar thread: http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/c488cf76-2515-440f-b3f8-9cfad689c5b6/ 

    My next response will be two days later, since here is weekend, if the above thread is not work, you can try this keywords "sql error 40".

    Sorry for any inconvenience.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 9, 2012 2:58 PM
    Moderator
  • I got more info. After upgrading to VS2012, the SQL Alias that we have configured is no longer used. In the connection string we have:

    data source=APPSQLTESTINSTANCE

    When I install the code compiled with VS2010, no problems. However, when it is compiled with VS2012, no connection can be made and fails with error mentioned above.



    Tuesday, November 13, 2012 6:34 PM
  • Found the solution. Our SA installed the 32-bit sql client and it started working again. 

    Now the question is why that is needed and not the 64-bit version that worked under VS2010.

    Tuesday, November 13, 2012 7:43 PM
  • Hi Eric,

    Your application is based on platform x86, right?

    An x86 application can refer the x86 reference, but not the x64 machine. And the platform you set in VS2012 should be anyCPU, and the OS is 64bit one, so the application is run under x64 platform rather than x32, so it cannot refer the 32bit reference, and vice versa.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, November 14, 2012 5:47 AM
    Moderator
  • We got everything to work following these instructions:

    1. Change the alias name from CIH[env] to CIHDB (so that we will no longer have to update the connection string after each update by having all environments using matching parameters)
        a. Start > Run > cliconfg.exe
        b. Under the Alias tab, Edit the alias
            i. Rename CIH[env] to CIHDB
    
    2. Create a 32 bit alias matching the 64 bit alias to support Visual Studio 2012
        a. Run c:\windows\syswow64\cliconfg.exe (this is the 32 bit version)
        b. Under the General tab, enable TCP/IP
        c. Under the Alias tab, Add an alias with the following:
            i. Name:  CIHDB
            ii. Network libraries:  TCP/IP
            iii. Server name:  CIH[env]DB\CIH[env]
            iv. Port:  [check the 64 bit alias for the correct port]

    • Marked as answer by Eric Coffman Monday, December 3, 2012 8:14 PM
    Monday, December 3, 2012 8:14 PM