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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bbimisAuthor Commented:
thanks sorry for delay getting back
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.