Wei Cong
Wei Cong

Reputation: 15

Deploying Microsoft ASP.NET application

I am trying to deploy an Microsoft ASP.NET application over to a hosting provider. I don't think I am able to configure the IIS server or anything like that.I have managed to upload my files to the server through FTP but I am facing 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."

I am able to access the databases of the domain but I am not sure what configurations to use especially for my web.config. I am using an mdf file

    <?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <connectionStrings>
    <add  name="DBConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Details.mdf;Integrated Security=True;User Instance=True;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
    <system.web>
       <customErrors mode="Off"/>
        <compilation debug="true" targetFramework="4.0">

    </compilation>
    <authentication mode="Forms">
      <forms timeout="50"/>
    </authentication>

    <sessionState cookieless="true" regenerateExpiredSessionId="true"  mode="InProc" timeout="60"  />
        <httpRuntime executionTimeout="180" requestValidationMode="2.0" requestPathInvalidCharacters="" maxRequestLength="1048576" />

  </system.web>
</configuration>

Upvotes: 0

Views: 67

Answers (1)

Erik Noren
Erik Noren

Reputation: 4339

It looks like your application is using SqlExpress to work with a local (to your project) database. Two things to look for - first, did the MDF absolutely make it to your deployed location? Sometimes things in App_Data are left behind during a publish. The other thing to check is whether the hosting provider to which you've deployed supports SQL Express and that the Data Source in your connection string is the proper way to utilize it on that platform.

Upvotes: 1

Related Questions