gpt4 book ai didi

asp.net - 具有共享主机的 ServiceStack : SecurityException and ReflectionPermission

转载 作者:行者123 更新时间:2023-12-02 03:16:09 25 4
gpt4 key购买 nike

我面临以下问题。我有基于服务堆栈的网络服务,我想在共享主机上使用它。在那里部署并尝试打开 url 时出现以下错误:

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 for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 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 for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +34
System.Security.CodeAccessPermission.Demand() +46
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Module m, StackCrawlMark& stackMark, Boolean skipVisibility) +243
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Module m, Boolean skipVisibility) +48 ServiceStack.Text.ReflectionExtensions.GetConstructorMethodToCache(Type type) +586
ServiceStack.Text.ReflectionExtensions.GetConstructorMethod(Type type) +68 ServiceStack.Text.ReflectionExtensions.CreateInstance(Type type) +8
ServiceStack.ServiceHost.ServiceController.RegisterNServiceExecutor(Type requestType, Type serviceType, ITypeFactory serviceFactoryFn) +123
ServiceStack.ServiceHost.ServiceController.RegisterNService(ITypeFactory serviceFactoryFn, Type serviceType) +287
ServiceStack.ServiceHost.ServiceController.Register(ITypeFactory serviceFactoryFn) +96
ServiceStack.ServiceHost.ServiceManager.Init() +50
ServiceStack.WebHost.Endpoints.AppHostBase.Init() +43
DarkMindFx.Global.Application_Start(Object sender, EventArgs e) +571

所以看起来 ServiceStack 无法执行反射。我也试过

<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>

到 web.config,但结果托管返回我 web.config 中这一行的错误。有没有人遇到过这样的问题?有什么解决办法吗?

最佳答案

SecurityException 是因为 GoDaddy doesn't support full trust ASP.NET hosting .您可以尝试请求他们的支持为您的站点启用它,否则您将需要使用不同的托管服务提供商。

关于asp.net - 具有共享主机的 ServiceStack : SecurityException and ReflectionPermission,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36959023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com