I have an asp.net website which worked fine when i ran on localhost on my system. But i am trying to host it online. i am getting this error.
The system cannot find the file specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified]
[SqlException (0x80131904): 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)]
DALayer.clsDataLayer.ExecuteSqlString(String sqlstring) +143
DALayer.clsCategory.LoadCategory() +36
MedicineManagement.UserMaster.LoadCategory() +55
MedicineManagement.UserMaster.Page_Load(Object sender, EventArgs e) +36
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
This is my connection string.
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="DBcon" connectionString="Data Source=localhost;Initial Catalog=OnlineMedicine;User Id=danish;Password=XXXXXXXX;Trusted_Connection=True;Integrated Security=False;" providerName="system.Data.SqlClient" />
</connectionStrings>
I am publishing it on plesk. This website is related to online pharmacy management.
I tried hosting my website but i got errors
1
Answers
Your
connectionString
is pointing at "localhost", which is why it works on your machine. But if the website is hosted elsewhere "localhost" needs to be changed to the server hosting the database. E.g. us the server IP address.