0

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>
1
  • I'm not an expert, but if you would install your web application online you might have a SQLServer on your hosting. If you have this, you must create a new database, tables and import the necessary data. Next you must modify the connectionstring in your web.config (sorry for my bad english) Commented Feb 10, 2014 at 16:29

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Not sure if my hosting provider supports SQL Express, what are the the different steps needed to be done if they do support and they don't support? Iam sure that my mdf file has been uploaded properly to the hosting provider. I am not sure if it has anything to do with it, but am I required to create a new database on the hosting server? If so, how do I do transfer it over?
These are all great questions. For your hosting provider. Basically if they don't support SQL Express, you'll need to see what they do create and then deploy your database to that and then update your connection string. If they do support SQL Express, maybe they are using a different connection string. I'd check your hosting provider's FAQ, Forums or email their support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.