Unable to connect to SQL Server instance after hosting web site - c#

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, e.g.).

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.

Related

Stumped trying to connect IIS 7 to my localdb running inside of Visual Studio 2015

For the life of me I am unable to connect to my localdb hosted database created in Visual Studio 2015 to my local IIS 7 instance running on the same machine. IIS Express works fine but when I wanted to test things as a user outside of my network I dabbled with a Local copy of IIS.
I have tried everything from ensuring the app pools have the right privileges, that my connection strings are accurate and just about every thing else I have found on the web but I cannot for the life of me get this working.
The error I am getting is the following: 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: 50 - Local Database Runtime error occurred. Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
)
Connection String in VS2015:
Any other details needed to help troubleshoot ask and I will provide.
Thank you in advance for reading.

Which are necessary steps to connect to an Azure SQL database in Visual Studio or SQL Server Management Studio?

I am using Visual Studio 2013 with update 5. I created a SQL database on Azure.
Now I am trying to connect to it in VS and SQL Server Management Studio, but I get this error
Error : Connect to Server
Cannot connect to MyServerName.database.windows.net.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: 53)
The network path was not found
Before connecting to Azure SQL I have taken these steps:
Added machine's IP in SQL Azure firewall
Opened port 1433 by adding a new outbound rule in firewall on my local machine
I want know which step I missing in whole process.
Well. This is hapenning because tha address you're using isn't ok to access. Try to connect through the IP, and make sure you're using the PUBLIC IP/DNS. Try to open the firewall on both sides. That's all that I could help you with the information error reported for you. The conection string that you're using is not ok or not accessible.
VS2013 and above has a decent cloud explorer screen, I'd recommend navigating to the resource through that first. You can also use the Server Explorer to navigate to the right resource and open in in SQL Server Object Explorer. That will at least eliminate if it's an issue with your stored credentials.

Sql Server Connection Error in C# app

My objective was to make a database for general store. Information was very scattered about how to create database and why in that way. So i selected SQL Server Express.
Application was made in C# Visual Stduio 2012. Database was created with SQL management Studio. To connect the application with database i used serverexplorer in visual studio and assigned ./sqlexpress
Now the problem is that database works fine on my pc but when i deploy application on the clients pc it says
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)
Connection String Used connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=pos;Integrated Security=True";
Where i went wrong ? Is database also deployed with published app or i have to do some other steps ? Will i have to install SQL server on client pc too?
Note: The application is local. i don't need to transfer data via internet.
Let me know according to your experince what is the right way to attach,create and deploy database the right way for this small project because internet is full of guide but there is no where mentioned properly why the specific method is adopted etc
I solved the issue by download sql server management studio on client pc. I just made a backup of database form my management studio and restored that backup file from clients management studio. And now everything is working

Deploy WCF service with database

I've created an ASP.NET MVC4 project in Visual Studio 2013 and I've created and attached a local database using SQL Server Express. I will deploy this project to a Cloud service, how do you publish the database to Cloud service?
Regards,
Roger
EDIT: I have created my Database using Visual Studio 2013 in Server Explorer Window, right click on Data Connections and Create New SQL Server Database... after connect successful this database in my project on localhost. Now, I have deployed my project to Azure Cloud Service, but How do I upload the database in the same Azure Cloud Service?
EDIT 2: I've created my database in App_data, on localhost works fine but when I deploy to Cloud Service, shows the following error when program calls the database:
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).
My connection String is:
this.ConnectionString = #"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MidSapDB.mdf;Integrated Security=True;User Instance=True";
When you right click on the project you should see publish. Click on publish it will take you to a page where you shall able to configure IIS, database etc. Please let me know if you know more details. It should be very straightforward.

How to deploy C# Sql project on clients/target machine?

I have developed an inventory system in C# ,database used is SQL server .Now my problem is how to deploy my project with database and run it on client's machine i have 1 more week remaining in delivering this project .I tried many blogs and sites but all in vain and i did not get any good resource which clearify me all this scenerio.The current publishing process does not have a database file and showing me an 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
Please any suggestions would be highly appreciable?
I am using Visual Studio 2013 and SQL Server 2012!
By default, SQL Server have network access disabled after a fresh install. You need to use the SQL Configuration Manager to allow remote connections to the instance.
See this post:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
http://www.romankagan.com/?p=118
If after this you still can't connect, verify that SQL Server ports are not been blocked by the machine firewall.

Categories

Resources