0

In an ASP MVC project I am using for Authentication the ASPNETDB.mdf in my App_Data folder , and as the project datasource a connection string to my SQL Server 2008 from my hosting provider.

My connection strings are :

<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
 <add name="myConnectionString" connectionString="Data Source=xx.xx.xx.xx;Initial Catalog=db_name;User ID=myid;Password=mypass" providerName="System.Data.SqlClient"/>

The issue is that locally, Authentication works just fine, but after I deploy my project, Authentication fails but the other connection to the data works.

I saw that for the first connection its using Windows Authentication. Should i change the first connection string?

1
  • What kind of issue are you having I used to have a similar issue 1. Make sure that the data source name of the conection you are using and works fine is the same as the one used in app data 2. make sure you give your app the read and write permission to the App_Data folder.
    – COLD TOLD
    Commented Dec 30, 2011 at 23:24

1 Answer 1

0

More than likely, the SQL instance on your deployed server is not SQLEXPRESS. You should use the same server name as you use in your second connection string.

3
  • ok, i'll try this now, but will this mean that i have to switch back and forth when i have to deploy it and when i have to work locally?
    – Alex Peta
    Commented Dec 30, 2011 at 22:52
  • @AlexPeta - Yes, thankfully visual studio provides an easy way to do this. vishaljoshi.blogspot.com/2009/03/… Commented Dec 30, 2011 at 22:59
  • i figured it out in the end. i've exported the local scripts and ran the on the server to recreate the database and used just the SQL connection that was pointing tot he server not the file.
    – Alex Peta
    Commented Feb 8, 2012 at 15:05

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.