sql express on windows server 2008

can someone link me or give me detailed instructions on how to setup sql express to work with my asp.net page.
I wrote a simple database nothing fancy using the server explorer. its named database1.mdf

works fine on my local pc but I'm wanting to put it on the server to test.  I keep getting sql errors which I assume is related to the connection. it says it can't connect to the master as guest? I just don't know how to set it up so any help would be great. thanks!
bbimisAsked:
Who is Participating?
 
Miguel OzSoftware EngineerCommented:
First of all we need to fix the SSMS permission issue in order to attach database.
Please let me know what windows account you are using to run SSMS.
From MSDN: "Database Engine tries to impersonate the Windows account of the connection performing the operation to guarantee that the account has permission to access the database and log files".
Note: Better run it using a windows admin account.
Then make sure your account have read/write permissions (or full control) over your database files and your files are no blocked (see option 1).
0
 
Miguel OzSoftware EngineerCommented:
Assuming that the site is properly setup in IIS, you need to check:
1. Is  SQL Express properly installed? (Same version as your PC or higher - make sure you can access it using SSMS as shown here)
2. Is your site authentication windows authentication?
Chances are you are just missing 1 or 2.
If you are connecting to the website anonymously then you could have connection issues even if your code is working fine in your PC, then you should use SQL Server Authentication or impersonation.  (e.g. Add
 
If more help needed please specify/post:
1. Web form or Asp.net mvc? Version?
2. .NET/VS version
3. Web config file  (Local and server if different)
4. connection string (if not in config)
5. The exact error wording
0
 
bbimisAuthor Commented:
Sorry for delay just got home. Anyway I took and check with the sql server manager and was able to connect when I hit test connection.
it then showed the databases like master and so on
db tree
I have a database in my visual studio project called database1.mdf
with a connection string in the webconfig file as follows:
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <connectionStrings>
    <add name="dbconn"
    connectionString="Data Source=.sqlexpress\v12.0;AttachDbFilename=|DataDirectory|\database1.mdf;Integrated Security=True"
    providerName="System.Data.SqlClient"
/>
  </connectionStrings>
</configuration>

Open in new window


when I have it as localdb it works just fine when running on my local system.
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <connectionStrings>
    <add name="dbconn"
    connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\database1.mdf;Integrated Security=True"
    providerName="System.Data.SqlClient"
/>
  </connectionStrings>
</configuration>

Open in new window

I go to sql manager and hit attach and select the database1.mdf and I get the following error:
something about sql guest even though i'm logged in as the administrator
this is a asp.net web form.
.net 4.5


and thanks!
0
 
bbimisAuthor Commented:
thanks sorry for delay getting back
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.