Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I think this falls into the category of 'never ask a developer to do a server administrator's job'.

I'm a developer writing a couple of ASP.NET MVC 2 sites. I've attempted to use the ASP.NET Configuration Tool to create some user roles, but it keeps giving me an error stating that it can't find my data store, and that the AspNetSqlProvider cannot connect to the db. I have run aspnet_regsql, but that only created the tables necessary for user management. It did nothing to help my connection problem. From what I can see, my connection strings are okay.

As a test, I fired up some MVC tutorial apps in the debugger. Both displayed and saved my inputed data, so it seems like the database is working to some extent.

Following that, I decided to test if I could attach some .mdf files to the db via the Management Studio. I tried both an 'empty' file (folder structure intact, but no tables) and one that I've fleshed out for one of my projects. In both cases, the Management Studio claimed it couldn't find the files, despite both existing and me manually entering their paths.

All of this seems to point to a permissions issue. I'm just not sure on which side the problem resides - db or files - or how to fix it. Any help would be greatly appreciated.

Note: all of this is happening on my Win 7 laptop, with Visual Studio 2010 Professional.

share|improve this question
    
It is not permission issue, it is peculiarities of working with db through VS(Server Explorer) and SSMS. Use only one of them, you can't use both –  Gennady Vanin Геннадий Ванин Aug 28 '10 at 5:21

1 Answer 1

up vote 1 down vote accepted

When you say "attach some .mdf files to the db" I'm going to assume you mean to the SQL instance. You don't really attach .mdf files to an existing db.

A couple of things to check:

  • What version of SQL were the .mdf files created with? If it's 2008 R2 then you won't be able to attach them to a straight-up 2008 instance, they're not backward compatible.
  • Are you also bringing the log file(s) over when you try to attach the .mdf files? Depending on what recovery model the databases were create with you'll also need those. By default SQL will create a database and set it to the full recovery model in which case it needs the log file(s) in order to get the database back to its current state.
share|improve this answer
    
The .mdf files were created within VS 2010. AFAIK, the laptop is only running the version of SQL Server 2008 that comes with VS 2010 Professional. The corresponding log files were automatically added to the list of .mdf files to attach when I entered in the .mdf paths. –  KevinM1 Aug 27 '10 at 14:39
    
Actually, now that I'm on my laptop, I see I have both SQL Server 2008 (64-bit) AND SQL Server 2008 R2 (32-bit). Both seem to be Express. I can't tell if both, or just one is running. The management studio only shows one sqlexpress instance running. I believe my copy of VS 2010 is 32-bit, if that makes a difference. It's the version available through the Website Spark program. –  KevinM1 Aug 27 '10 at 16:27
    
Well, I was able to detach the role management db from the instance and add the .mdf to my project's App_Data folder, like what was done with the MVCMusicStore demo. Didn't fix my overall issue of the provider not seeing the server, but feels like some progress. –  KevinM1 Aug 27 '10 at 17:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.