2013-04-21 207 views
1

我正在使用SQL Server(MSSQLBlogProvider)在主網站下的虛擬目錄中安裝應用程序(BlogEngine)。 BlogEngine有它自己的數據庫。EXECUTE權限被拒絕 - 'aspnet_Roles_RoleExists'

所有的工作,這意味着我得到了SQL數據庫提供的默認頁面。

然後,我使用ASP.net網站管理工具\安全來創建用戶(如在這個視頻http://www.nyveldt.com/misc/BE13SQLMembership.html約7分鐘標記所示)。很好解釋,它很容易,快速地看到他在做什麼,如果你點擊視頻)

的時間表以下這些步驟後,我得到的錯誤:

執行權限被拒絕的對象「aspnet_Roles_RoleExists」數據庫「博客」,架構「DBO」上。我玩「訪問規則」但沒有成功。

請注意,我正在使用「集成安全性」。

我並不完全知道要查看什麼和在哪裏進行修改。高度讚賞任何幫助。

堆棧跟蹤:

[SqlException (0x80131904): The EXECUTE permission was denied on the object 'aspnet_Roles_RoleExists', database 'Blog', schema 'dbo'.] 
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +688 
    System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4403 
    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6665097 
    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +6667096 
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +577 
    System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +735 
    System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +290 
    System.Web.Security.SqlRoleProvider.RoleExists(String roleName) +967 
    System.Web.Security.Roles.RoleExists(String roleName) +336 
    BlogEngine.Core.Right.InitRightForBlogInstance() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Security\Right.cs:612 
    BlogEngine.Core.Right.get_RightsByRole() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Security\Right.cs:600 
    BlogEngine.Core.Right.EnsureBlogInstanceDataLoaded() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Security\Right.cs:566 
    BlogEngine.Core.Right..cctor() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Security\Right.cs:113 

[TypeInitializationException: The type initializer for 'BlogEngine.Core.Right' threw an exception.] 
    BlogEngine.Core.Right..ctor() in j:\Projects\BlogEngine_2_7_0_0\blogengine_4f5eed923a57\BlogEngine\BlogEngine.Core\Security\Right.cs:539 

[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 
    System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +159 
    System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256 
    System.Activator.CreateInstance(Type type, Boolean nonPublic) +127 
    System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14376269 
    System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +200 
    System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28 
    System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83 
    System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +335 
    System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1262 
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +133 
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304 
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475 

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601 
+0

我發現了一個可能的線索在這裏:http://blog.dampee.be/post/2009/04/07 /EXECUTE-permission-denied-on-object-aspnet_CheckSchemaVersion-database-myDB-schema-dbo.aspx - 我可以添加權限到「集成安全性」 - 用戶嗎? – graph 2013-04-21 17:48:40

回答

2

打開Internet信息服務管理器
檢查哪些應用程序池的IIS網站使用
轉到應用程序池
看到什麼身份你的應用程序池的

下運行

打開SQL Server Management Studio
連接到您的SQL Server實例
打開一個新的查詢您的數據庫
運行此腳本:
GRANT SELECT,EXECUTE,UPDATE,INSERT ON SCHEMA :: DBO TO
[NT AUTHORITY \ NETWORK SERVICE]

*替換[NT AUTHORITY \ NETWORK SERVICE]與您的應用程序池所運行的任何標識。

回到IIS管理器
回收您的應用程序池
瀏覽到您的網站

+1

出現錯誤:找不到用戶'myIdentity',因爲它不存在或者您沒有權限。 – JoeManiaci 2014-10-20 16:05:11

+0

@Duke Hall:非常感謝。我的問題解決了:) – Farzaneh 2015-11-30 11:55:18