首页 > 解决方案 > 无法在 Plesk Web Hosting 上托管 Umbraco CMS。获取 System.Security.SecurityException:错误

问题描述

我正在尝试在 Plesk Web Hosting 上托管 Umbraco CMS 但出现安全异常,我还尝试将CAS 信任级别更改为 FULL但没有成功,请参阅下面的完整错误:

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request failed.]
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +96
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +80
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +288
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) +70
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
   System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +40
   System.Type.GetType(String typeName) +30
   System.CodeDom.Compiler.CompilerInfo.get_IsCodeDomProviderTypeValid() +10
   System.Web.Compilation.CompilationUtil.GetRecompilationHash(CompilationSection ps) +2399
   System.Web.Configuration.CompilationSection.get_RecompilationHash() +92
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDateInternal(Int64 cachedHash) +502
   System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate(Int64 cachedHash) +53
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +133
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +695

此外,我修改了 Web.config 文件并添加了<trust level="Full" />,请参见下面的代码:-

<system.web>
<customErrors mode="Off" />
...
...
<trust level="Full" />
</system.web>

修改 Web.config 文件后出现配置错误,请参阅下面的完整错误

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: This configuration section cannot be used at this path.  This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

Source Error:

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

我还根据 Umbraco CMS Umbraco CMS 设置指南-> 文件和文件夹权限更改了所需的文件和文件 夹权限

请帮助我了解如何在 Plesk Web 托管环境上托管 Umbraco ASP.NET CMS。

服务器详情:

托管服务提供商:Plesk

.Net 框架版本我正在使用 4.7.03062

标签: c#asp.netumbraco8plesk-onyx

解决方案


您使用的是哪个主机?您需要联系您的托管服务提供商以获得完全许可。如果您的托管服务提供商不支持完全信任,尽管在您的代码上使用了完全信任,但它不会起作用


推荐阅读