在iis 7下运行web应用程序asp.net mvc 3时出现问题
我在 IIS 7 (Windows 7) 下部署了我的 asp.net mvc 3 项目。项目在 App_Data 文件夹中包含附加 *.mdf DB 文件。首先,我收到以下错误:
由于检索用户的本地应用程序数据路径失败,无法生成 SQL Server 的用户实例。请确保用户在计算机上拥有本地用户配置文件。连接将被关闭。
我删除了它,因此更改了我的 web.config 文件中的连接字符串 - 删除 user instanse=true 和应用程序池 -> >高级设置->流程模型->加载用户配置文件设置值 TRUE,然后我收到下一个错误: 数据库“master”中的 CREATE DATABASE 权限被拒绝。 尝试为文件 C:\inetpub\wwwroot\assign\App_Data\AssignmentDB.mdf 附加自动命名数据库失败。存在同名数据库,或者无法打开指定文件,或者它位于 UNC 共享上。
我的连接字符串是
<add name="AssignmentDBEntities" connectionString="metadata=res://*/Models.AssignmentDBModel.csdl|res://*/Models.AssignmentDBModel.ssdl|res://*/Models.AssignmentDBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AssignmentDB.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
我不知道如何解决此问题..(( 有人可以帮助我吗?
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="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AssignmentDB.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I don't known how resolve this problem..((
someone can help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您用于连接到数据库的帐户(在连接字符串中指定)没有 CREATE DATABASE 权限。您需要授予此权限才能创建数据库。
您只需执行sql命令即可(http://msdn.microsoft.com/en- us/library/ms178569.aspx)或使用企业管理器授予权限。
您需要授予权限的用户是连接字符串中指定的用户,或者是您的网站运行所用的帐户(如果您使用集成安全性)。
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.