您好,我得到一个错误,当插入记录到数据库,而从IIS运行的项目,我将运行通过Visual Studio,它工作得很好。
The INSERT permission was denied on the object 'tblPageInfo', database 'master', schema 'dbo'.
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: The INSERT permission was denied on the object 'tblPageInfo', database 'master', schema 'dbo'.
Source Error:
Line 43: string s = "insert into tblPageInfo values('" + PageName + "','" + Url + "','" + PageTitle + "','" + CanonicalUrl + "','" + MetaDescription + "','" + MetaKeyword + "','" + H1Text + "','" + H2Text + "')";
Line 44: SqlCommand cmd = new SqlCommand(s, con);
Line 45: cmd.ExecuteNonQuery();
Line 46: con.Close();
Line 47: }
Source File: D:\Kartik\Materials\CMS\CMS\AddPage.aspx.cs Line: 45 发布于 2013-02-27 21:42:21
您的网站将在没有权限(应用程序池的权限)的用户的上下文中运行,可能是NetworkService或类似的用户。解决方案是创建一个对数据库具有相关权限的用户,并在连接字符串中显式声明凭据。
一句关于什么不应该做的建议是这样的。无论多么诱人,都不要为了使用集成安全性而向用户授予在这些权限下运行的应用程序。这很糟糕。
发布于 2013-02-27 21:42:54
您是否检查了web.config中的连接字符串
https://stackoverflow.com/questions/15113518
复制相似问题