Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I publish a website of ASP.NET, C#, database and report rdlc in visual studio 2019 that can access by others using the link


What I have tried:

How do I publish a website of ASP.NET, C#, database and report rdlc in visual studio 2019 that can access by others using the link
Posted
Updated 2-Mar-20 22:32pm
v4
Comments
Viswanatha Swamy 3-Mar-20 4:41am    
Good afternoon. Could you please post the error message which you have posted earlier? Many thanks.
WeiJun420 3-Mar-20 4:49am    
Actually i know how to publish the website,and can display well,but the database and report rdlc in my visual studio didnt display, i dont know how to connect to the database while publishing . Here is the 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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
"
Viswanatha Swamy 3-Mar-20 4:57am    
Good afternoon. Could you please paste the connection string inside the rdlc file. You can remove the User Name and Password before pasting the connection String
WeiJun420 3-Mar-20 5:01am    
good afternoon,here is the connection string "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\admin\source\repos\InventoryList\InventoryList\App_Data\InventoryList.mdf;Integrated Security=True" there is no username and password.
Viswanatha Swamy 3-Mar-20 5:04am    
Thanks. I see you are connecting to your local database. Now the query is where are you publishing? If you are publishing to Azure OR Any other could, then the hosted application will be trying to reach the database with your local setting and will throw the above-mentioned exception. Could you please advise if you are hosting the website outside your Laptop?

The error message is pretty specific:
Quote:
The server was not found or was not accessible.

It even tells you what to check to find out why!

So check your connection string, make sure it is accessible from the server running your website, and that the supplied login ID / password combination is correct and valid for that server.
 
Share this answer
 
04-Mar-2020
1. Open Internet Information Server.
2. Select your Website under Site.
3. In the right side panel you will see the ASP.net section.
4. Double click the "Connection Strings" Icon and specify the connection string. The name of the connection string should exactly match with the existing name in your code.

You have to execute the below-mentioned commands from the command prompt.
C:\Users\PK.Viswanatha-Swamy>sqllocaldb info
MSSQLLocalDB
ProjectsV13

C:\Users\PK.Viswanatha-Swamy>SQLLocalDB.exe start MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.


sql server - MSSQLLOCALDB databases aren't listed - Stack Overflow[^]

03-Mar-2020
Good afternoon. Could you please verify the Network Configuration (Enable Named Pipes and TCP/IP Connections) in SQL Server Configuration Manager. The error "Instance specific" points to that. Please refer to the link below for additional reference. Many thanks.

Aliases (SQL Server Configuration Manager) - SQL Server 2014 | Microsoft Docs[^]
 
Share this answer
 
v5
Comments
WeiJun420 3-Mar-20 20:21pm    
Inside my computer dont have SQL Server Configuration Manager, I use the SQL server that are already inside the visual studio 2019.
Viswanatha Swamy 3-Mar-20 23:45pm    
@WeiJun420,
Good morning. I have updated the solution 2 with the steps to add connection string inside your published website. Please let me know how did it go. Many thanks.
WeiJun420 3-Mar-20 23:59pm    
It still prompt the same error, i already put the same connection string name but it still doesnt work.
Viswanatha Swamy 4-Mar-20 0:04am    
@WeiJun420,
Do you have SQL Server installed on your Laptop? Please advise.
WeiJun420 4-Mar-20 0:49am    
Dont have. Do you know how to download?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900