Hello i want to transfer my web application to the remote server, this is my local web.config file, can someone pls help me with this? I am using godaddy.I know i have to use the remove .. but i don't know how to do it using visual studio 2010. I am also confuse with the add name="applicationservices". in visual studio 2005 its <add name="LocalSqlServer"
Please i need help and clarification
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
1: You need to upload your database to your server.
2: Use godaddy's functionality to attach that database to their SqlServer.
3: Adjust your connectionstring to point to the DB on godaddy's server. You will have to ask them for the format.
4: Adjust your web.config.
Check if this helps:
Related
I am totally new to .NET VB, I have this code in Web.config:
<connectionStrings>
<add name="myDBConnectionString" connectionString="Data Source=storage\webdb;Initial Catalog=myWebDB;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
I want to know where is the database saved? how can I edit my database directly?
When I click the Security tab on the ASP.NET Web Site Administration Tool, I get this error.
"Unable to connect to SQL Server database.".
I'm using Visual Studio 2012
<configuration>
<connectionStrings>
<add name="devices" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\devices.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="users" connectionString="Data Source=(LocalDB)\v11.0;AttachDbfilename=|DataDirectory|\database.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\devices.mdf;Integrated Security=True
Looking at your data source. Does (LocalDB)\v11.0 exist and can you connect to the above DB?
If not that will be the reason....
I have found that every time I create a package for my website (For manual deployments), it overwrites my connection string in the package being created with the above data source.
This can be a blessing some times preventing your new website from launching. (Especially if its in the wrong environment. :)
http://www.connectionstrings.com/ This site is great for helping you creating connection strings for almost any DB.
I added database file to my built in sql server of Visual Studio and i have also connection string of it but i am confuse how to add this connection string into web.config
here is my try to add connection string to code below :
<connectionStrings>
<add name="myFirstConnectionString" connectionString="Data Source= .\SQLEXPRESS;AttachDbFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf"; Integrated Security=True;Connect Timeout=30;User Instance=TrueproviderName="System.Data.SqlClient" />
</connectionStrings>
I am much confused that how i can add connection string of my visual studio built in database file to web.config.
Please help me as i am new in asp.net and ignore my way of asking.
To make your connection string work with the path you've given, it should look somewhat like this:
Visual Studio 2012 (SQL Server 2012):
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="Data Source=(LocalDB)\v11.0;Integrated Security=True;AttachDBFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf";Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Visual Studio 2010 (SQL Server 2010):
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename="C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf";User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
But you should consider moving the database file to the App_Data folder in your project, and then use AttachDBFilename=|DataDirectory|MyFirstTask.mdf instead.
You should place you .mdf in App_Data folder, then you can use this
<connectionStrings>
<add name="myFirstConnectionString"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|MyFirstTask.mdf;
User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>
With C:\Users\Ahdus\Desktop\First Task\First Task\MyFirstTask.mdf, if you move your application to another machine, that path might not exist
|DataDirectory| maps to your application App_Data folder
When you create a new ASP.NET project with membership it creates the default connection string for ApplicationServices as follows:
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
Is there a way to force this to use SqlServerCe in the App_Data folder instead of creating it in sql express?
no its not possible, but you can check it via code for data source..
I purchased a Windows shared hosting account on godaddy that came with 2 MSSQL databases. I setup one to hold my site data and the other installed aspnet membership schema to store site members. The site works perfectly even displaying data from the 1st database. However when I try to login or register I get this nasty error
Exception Details:
System.Configuration.Provider.ProviderException:
The SSE Provider did not find the
database file specified in the
connection string. At the configured
trust level (below High trust level),
the SSE provider can not automatically
create the database file.
Ive gone through my web.config and there's nothing wrong with my 2 connection strings. It seems godaddy has a problem with using 2 mssql databases simultaneously when 1 is for membership.
Does anyone know a solution or a workaround?
I hope my experience benefits every one. Basically if you want to avoid aspnet membership problems on godaddy always use "LocalSqlServer" as the connectionstring. i.e
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider" connectionStringName="LocalSqlServer"
..other attributes here... />
</providers>
Then create the "LocalSqlServer" connectionString...remember to remove it first
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer"
connectionString="Data Source=xxxx; Initial Catalog=xxx; User ID=xxx; Password=xxx;"
providerName="System.Data.SqlClient" />
</connectionStrings>
I ran into same problem and am using MVC3. Above solution works but with some other changes in MVC3. It took me long time to figure it out so if anybody has similar issue in MVC3 it might help them:
Search for "connectionStringName" in web.config and replace the name with connectionStringName="LocalSqlServer"
Also under connectionstrings make sure
-To add (As this is important for all who are using shared hosting it will replace machine.config LocalSqlServer connectionstring with yours.)
-Keep your current connectionstring (In my case it is FilmiDb, this is required for you to connect to the database in EF model. Without this you will get errors.)
<connectionStrings>
<remove name ="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Initial Catalog=SofilmiDb;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
<add name="FilmiDb" connectionString="Data Source=.\SQLExpress;Initial Catalog=FilmiDb;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
</connectionStrings>