Security Exception on UOL Host

Asked

Viewed 257 times

2

I developed an ASP.NET MVC application that runs perfectly on site.

When climbing it to UOL Host, when accessing the page (www.manuelaibi.com.br) I have the error Security Exception...

It is important to note that I have already changed Web.config to have the lines

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

on the system web key.

All the research I did didn’t find any more reason not to work.

Would anyone have any idea, please?

Only to complete the information set the error stack is:

[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() +12 System.Web.Compilation.CompilationUtil.Getrecompilationhash(Compilationsection ps) +2045 System.Web.Configuration.CompilationSection.get_RecompilationHash() +107 System.Web.Compilation.BuildManager.Checktoplevelfilesuptodateinternal(Int64 cachedHash) +458 System.Web.Compilation.BuildManager.Checktoplevelfilesuptodate(Int64 cachedHash) +51 System.Web.Compilation.BuildManager.Executepreappstart() +135 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

3 answers

0

Hello, following the documentation you should add the security policies correctly. Add this line to your web.config file: Follow the documentation of the levels of possible security Follows the documentation of Breaking changes, for that version of . net.

<system.Web>
...
    <trust level="Full"/>
...
</system.Web>
  • It is already there... You can see that I mentioned it in the question... But it’s not working...

  • Separate the words, see how you put: <trustLevel name="Full" policyFile="Internal"/> . It should be as follows: <trust level="Full"/> removes the policyFile="Internal" attribute, if it works, then you put it back.

0

No use adding Trust Level, trust name or something like that because it will block the same way. In my case, just remove the section below the web.config:

<system.codedom>
    <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
</system.codedom>

0

When using the attribute trustLevel name="Full" conflicts with the lines of the system.codedom key and these should be commented out of the Web.config

Browser other questions tagged

You are not signed in. Login or sign up in order to post.