应用程序无法在IIS时打开SQL连接 [英] Application cannot open SQL connection when on IIS
问题描述
我有一个看起来像这样的连接字符串:
服务器=;数据库= mydbname; Trusted_Connection = TRUE;
这当我运行/调试使用Visual Studio(IIS快递)我的应用程序工作正常,但部署后在 IIS-8
它抛出了我的异常,同时打开连接的:
登录失败用户'IIS APPPOOL\mysite。
块引用>
我很困惑,为什么发生这种情况的原因IIS是增加其用户在中间当数据库犯规要求之一,这是为什么不与
IIS快递
?
解决方案您正在使用
Trusted_Connection = TRUE
,因此用户ApplicationPoolIdentity或IIS APPPOOL\mysite
供应到SQL Server。
选项1。给权限
IIS APPPOOL\mysite
在SQL服务器
选项2 使用
用户ID = USER_ID;密码= ******
而不是Trusted_Connection = TRUE
I have a connection string that looks like this:
Server=.;Database=mydbname;Trusted_Connection=True;
This works fine when i run/debug my application using Visual Studio (IIS Express) but after deployment over
IIS-8
it throws me an exception while opening connection that:Login failed for user 'IIS APPPOOL\mysite'.
I am very confused why this is happening why IIS is adding its user in the middle when the database doesnt require one and why this is not happening with
IIS Express
?解决方案You're using
Trusted_Connection=True
and thus the user ApplicationPoolIdentity orIIS APPPOOL\mysite
is supplied to SQL server.Option 1. Give permissions to
IIS APPPOOL\mysite
in SQL server.Option 2. Use
User Id=User_Id;Password=******
instead ofTrusted_Connection=True
这篇关于应用程序无法在IIS时打开SQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!