简体   繁体   中英

Unable to connect to SQL Server instance after hosting web site

I have built a school portal using ASP.NET, it makes use of ASP.NET web administration to carry out authentication and authorization. On my development environment it works just fine but after uploading the web application onto the web via VS 2010's 'copy web site' tool I can no longer register or login on the site. When I click on the login or registration buttons I get the following error:

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

I dont know if it's worthy of note but it's an SQL Server Express Edition DB

Web site is www.confluenceinternational.academy

I usually do this when I'm unsure about the connection: on your desktop, create a new empty file named "test.udl". Double-click it and make your settings according to your DB and server configuration. You can also test your connection from there. When you have everything working, you can take the connection string from that UDL file (open with notepad, eg).

Thanks for the speedy replies guys.

I tried all your suggestions but was still stuck. I manage to solve the problem by using Visual Studio 2010's publish to provider option, and running the script on the Plesk Control Panel. After that, I just updated the web.config file to reflect the new database viathe connection string properties...

Now it works just fine, thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM