应用程序无法在IIS时打开SQL连接 [英] Application cannot open SQL connection when on IIS

查看:145
本文介绍了应用程序无法在IIS时打开SQL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看起来像这样的连接字符串:

 服务器=;数据库= 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 or IIS 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 of Trusted_Connection=True

这篇关于应用程序无法在IIS时打开SQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆