简体   繁体   中英

SQL Server not accessible from hosted ASP.NET app

I'm facing a problem with the deployment of an ASP .NET web application.

I uploaded project in somee.com (it provides free hosting services for ASP web applications). The url for the site is www.ipcboss.somee.com. Please go through this link and enter data for login and password. It has to display an alert message; if login credencials are correct it goes to some other page.

I'm getting an SQL instance error server not found error number 26 occurring. I changed the sql server path to the workstation path that is provided by somee.com in the web.config file. I uploaded database file .mdf format to the database provided by somee.com. I tried so many ways but I didn't get the solution. the connection string is

connectionString="workstation id=ipcsampledb.mssql.somee.com;packet size=4096;user id=yarrasuresh9999_SQLLogin_1;pwd=mypassword;data source=ipcsampledb.mssql.somee.com;persist security info=False;initial catalog=ipcsampledb"
   providerName="System.Data.SqlClient"

use this as a connection string..

<add name="ConnectionString" connectionString="Data Source=ipcsampledb.mssql.somee.com;Initial Catalog=ipcsampledb;User ID=yarrasuresh9999_SQLLogin_1;Password=pd4idnkycx"
          providerName="System.Data.SqlClient" />

it will solve your problem.

// I uploaded database file .mdf format to the database provided by somee.com.//

You need to figure out if your hosting company wants you to use this type of connection

AttachDbFilename

or not.

Ok. Uploading a mdf file doesn't automatically register the database. So sometimes you "initiate a registration" by using the AttachDbFilename syntax.

Other times, the mdf you upload has to be "wired into" a running instance of Sql Server. When this happens, you will NOT use the AttachDbFilename syntax.

There is no reason to "guess". Ask your hoster for an example connection string.

If they give you a non AttachDbFilename syntax, then ask them how your uploaded mdf file gets registered by sql server.

Create a udl file, if it connects then the problem is the code / application, if it does not connect, then it's your firewall, connections string, dll library, service you are running IIS under not having the right permissions etc etc. Well the important thing here is probably the connection string. Do the following: create an empty text file and rename it "myconnection.udl". Now double click on the file and it will launch an applet. You can configuer the connection to your database and test it. (it will pick up registered connection libraries etc). If it give OK, then open the udl file in notepad, you will see the correct connection string. Paste to your app connection settings. UDL files are generally misunderstood. They are simply a text file that holds the connection settings. They then call the connection dll. If the udl file works then you have a correct connection string 100%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM