簡體   English   中英

從IIS運行時拒絕插入權限

[英]Insert Permission denied when running from IIS

嗨,我在從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 

您的網站將在沒有權限(應用程序池的權限),可能是NetworkService或類似權限的用戶的上下文中運行。 解決方案是在數據庫上創建一個具有相關權限的用戶,並在連接字符串中顯式聲明憑據。

一個關於該做什么的建議就是這個。 但是,無論如何,都不要給用戶提供在這些權限下運行的應用程序以使用集成的安全性。 這不好。

您是否在Visual Studio和IIS中都檢查了web.config中的連接字符串

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM