繁体   English   中英

IIS至SQL Server使用不存在的用户名登录

[英]IIS to SQL Server logging in with username that doesn't exist

我完全没有问题,可以编译/调试我的Web应用程序,但是当我尝试从IIS服务器运行它时,出现此错误:

Server Error in '/' Application.

    Login failed for user 'MLABS\STUDENT-006$'.

    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 'MLABS\STUDENT-006$'.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 


    [SqlException (0x80131904): Login failed for user 'MLABS\STUDENT-006$'.]
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +578
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6275911
       System.Data.SqlClient.SqlConnection.Open() +258
       RadarGraphInsertDLL.LOMDLL.Get_Last_Lom() in c:\users\agordon\documents\visual studio 2008\projects\lomdb\enterdata\radargraphdll\radargraphinsertdll\lomdll.cs:212
       EnterData.DataEntry.LOMForm.Page_Load(Object sender, EventArgs e) in C:\Users\agordon\Documents\Visual Studio 2008\Projects\lomdb\EnterData\DataEntry\LOMForm.aspx.cs:20
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
       System.Web.UI.Control.OnLoad(EventArgs e) +132
       System.Web.UI.Control.LoadRecursive() +66
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

    Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5420

STUDENT-006是我的计算机名称,不是我的用户名! 我不明白为什么它要尝试使用我的计算机名登录。

当应用程序运行时,它应立即从数据库中提取数据。 我启用了Windows身份验证,并且从dubugger运行时它没有问题,但是当我尝试编译时,出现上述错误

我究竟做错了什么?

MLABS\\STUDENT-006$是IIS应用程序池运行所使用的用户名。 您可以在IIS中更改应用程序池用户

  1. 打开IIS管理器。 有关打开IIS管理器的信息,请参阅打开IIS管理器(IIS 7)。

  2. 在“连接”窗格中,展开服务器节点,然后单击“应用程序池”。

  3. 在“应用程序池”页面上,选择要为其指定标识的应用程序池,然后在“操作”窗格中单击“高级设置”。

  4. 对于“身份”属性,单击“ ...”按钮以打开“应用程序池身份”对话框。

  5. 如果要使用内置帐户,请选择“内置帐户”选项,然后从列表中选择一个帐户。

  6. 如果要使用自定义身份,请选择“自定义帐户”选项,然后单击“设置”以打开“设置凭据”对话框。 然后在“用户名”文本框中键入自定义帐户名称,在“密码”文本框中键入密码,在“确认密码”文本框中重新键入密码,然后单击“确定”。

  7. 单击“确定”关闭“应用程序池标识”对话框。

或者您可以模拟web.config

<configuration>
  <system.web>
    <identity impersonate="true"/>
  </system.web>
</configuration>

MLABS \\ STUDENT-006 $是连接到其他计算机以及如何在Active Directory中注册服务器时本地“ NETWORK SERVICE”帐户的外观的帐户。

这就是IIS中的“应用程序池”在其下运行,因此它连接到SQL Server。

我建议特别使用一个域帐户

暂无
暂无

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

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