简体   繁体   English

从asp.net应用程序连接到SQL Server数据库

[英]connect to sql server database from asp.net application

I have an sql database running locally. 我有一个在本地运行的sql数据库。 In visual studio, server explorer, I am connected to this database so I am sure of the validity of the connection string which is : 在Visual Studio(服务器资源管理器)中,我已连接到此数据库,因此可以确定连接字符串的有效性:

Data Source=MyMachineName;Initial catalog=MyDBName;Integrated Security=True

However when I am trying to access to the db from my application i am getting the following exception in my browser : 但是,当我尝试从应用程序访问数据库时,在浏览器中出现以下异常:

System.Data.SqlClient.SqlException : Authorization CREATE DATABASE denied in database 'master'

For information, I am running my application through my iis server. 有关信息,我正在通过iis服务器运行我的应用程序。

Thanks in advance for your help 在此先感谢您的帮助

Your IIS site by default is running under ApplicationPoolIdentity user, which does not have rights to your system. 默认情况下,您的IIS站点在ApplicationPoolIdentity用户下运行,该用户没有系统权限。 You can change that user to your user from IIS Manager. 您可以从IIS管理器将该用户更改为您的用户。 First find which "application pool" is your application running on, then go to that application pool in the "Application Pools", right click then select "Advanced Settings", and under "Process Model" you will find the "Identity" record. 首先找到正在运行您的应用程序的“应用程序池”,然后转到“应用程序池”中的该应用程序池,右键单击然后选择“高级设置”,然后在“流程模型”下找到“身份”记录。 在此处输入图片说明

PS If you haven't changed the application pool of your site just edit the "DefaultAppPool" PS:如果您尚未更改站点的应用程序池,则只需编辑“ DefaultAppPool”

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

相关问题 从ASP.NET MVC应用程序连接到SQL Server - Connect to SQL Server from ASP.NET MVC application ASP.Net Web应用程序连接到主机SQL数据库 - ASP.Net web application connect to host SQL DataBase 如何从在容器中运行的 ASP.NET 核心应用程序连接到具有集成安全性的 Windows 服务器上的 SQL 服务器 - How to connect from ASP.NET Core application running in a container to SQL Server on Windows Server with Integrated Security ASP.net应用程序无法连接到SQL Server命名实例 - ASP.net application unable to connect to SQL Server named instance 无法正确连接到ASP.NET应用程序中的SQL Server - Can't correctly connect to SQL Server in ASP.NET application 无法连接到SQL Server数据库(ASP.NET C#) - Unable to connect to SQL Server Database (ASP.NET C#) “无法连接到SQL Server数据库”-ASP.NET配置 - “Unable to connect to SQL Server database” - ASP.NET configuration 将ASP.Net应用程序从Web连接到计算机上的sql数据库 - Connect ASP.Net application from web to my sql database on my computer 无法从Asp.net应用程序连接Sql Server-问题频繁发生 - Unable to connect Sql Server from Asp.net Application - Issue occured frequently 无法从我的 ASP.Net 项目上的 VS2019 连接到 SQL 服务器数据库 - Cannot connect to SQL Server database from VS2019 on my ASP.Net project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM