简体   繁体   English

在iis7中发布站点后无法访问sql server

[英]cannot access sql server after publishing site in iis7

I am created a website using visual studio 2010. On the time of the development of website I am able to access the database.. but after publishing the site using IIS7..i was unable to access the database..the exception occured during that time was "the connection is in the closed state".in IIS7 When I changed the application pool identity to localsystem, it worked. 我使用Visual Studio 2010创建了一个网站。在开发网站时,我可以访问数据库..但是,使用IIS7..i发布网站后,我无法访问数据库..在此期间发生了异常当时是“连接处于关闭状态”。在IIS7中,当我将应用程序池标识更改为localsystem时,它起作用了。 Data base is installed in the same machine. 数据库安装在同一台计算机上。 and server is SQL SERVER 2008 R2 并且服务器是SQL SERVER 2008 R2

发布数据库后,您只能使用sql身份验证访问数据库。

In IIS7 the application pool by default runs under the IIS AppPool\\[Application Pool Name] 默认情况下,在IIS7中,应用程序池在IIS AppPool \\ [应用程序池名称]下运行

That means, if your app pool is called "MyWebSite", then you must give the following user permissions to use your database: IIS AppPool\\MyWebSite 这意味着,如果您的应用程序池称为“ MyWebSite”,则必须授予以下用户权限才能使用您的数据库: IIS AppPool \\ MyWebSite

It won't be in any list, so you'll have to type it as above when adding it. 它不会出现在任何列表中,因此添加时必须如上所述输入。

I suggest making it database owner if you're in doubt about which permissions to give it. 如果您对授予它的权限有疑问,建议将其设置为数据库所有者。 If it works, you can always refine the permissions later 如果可行,您以后可以随时调整权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM