我已经设置了一个运行 SQl Server Web 版和完整 IIS 7.5 的远程服务器。我能够毫无问题地将我的 MVC 4 应用程序部署到远程框,但是当我尝试运行该网站时,我收到以下错误:
Login failed for user 'IIS APPPOOL\backoffice.mysite.com'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\backoffice.mysite.com'.
错误控制台说:
Exception information:
Exception type: InvalidOperationException
Exception message: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588
at MyModels.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() in c:\Users\Administrator\Documents\MySite\MyModels\Filters\InitializeSimpleMembershipAttribute.cs:line 47
An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
正如错误日志所暗示的那样,我的连接字符串很可能不正确。我在 Visual Studio 中本地运行的连接是:
<add name="MyDB" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=MyDB;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\MyDB.mdf" providerName="System.Data.SqlClient" />
我已经为远程服务器上的连接设置了一个转换:
<add name="MyDB" connectionString="Data Source=(local);Initial Catalog=MyDb;Integrated Security=True" providerName="System.Data.SqlClient" />
通常我使用 SQL 登录,所以我在这里感到困惑。对于使用 Windows 身份验证的 SQL Server Web 版,连接字符串应该如何查找?
看起来 IIS APPPOOL\backoffice.mysite.com 正在尝试创建数据库。它是否正确?如果是这样,我不需要在 SQL Management Studio 中为此用户创建登录名和用户吗?
在运行部署之前,我是否需要在 SQL Management Studio 中创建数据库?
非常感谢!