user571874
user571874

Reputation: 589

Problem run web application asp.net mvc 3 under iis 7

I deployed my asp.net mvc 3 project under IIS 7 (Windows 7). Project contain attach *.mdf DB file in App_Data folder. First I got following error:

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

I removed it so change connection string in my web.config file - remove user instanse=true and in Application Pool -> Addvanced Setting -> Process Model -> Load User Profile set value TRUE and then I got next error: CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\inetpub\wwwroot\assign\App_Data\AssignmentDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

my connection string is

<add name="AssignmentDBEntities" connectionString="metadata=res://*/Models.AssignmentDBModel.csdl|res://*/Models.AssignmentDBModel.ssdl|res://*/Models.AssignmentDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AssignmentDB.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

I don't known how resolve this problem..(( someone can help me?

Upvotes: 2

Views: 517

Answers (1)

Jakub Konecki
Jakub Konecki

Reputation: 46008

The account you're using to connect to the database (specified in the connection string) doesn't have a CREATE DATABASE permission. You need to grant this permission in order to be able to create database.

You can just execute sql command (http://msdn.microsoft.com/en-us/library/ms178569.aspx) or use Enterprise Manager to grant permission.

The user you need to grant the permission to is the one specified in the connection string or the account your website runs under if you're using integrated security.

Upvotes: 2

Related Questions