Security Exception on UOL Host [closed]

closed. this question is out of scope and is not currently accepting answers.

want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 3 months ago .

improve this question

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

When uploading it to the host UOL, when accessing the page (www.manuelaibi.com.br) I have the security error Exception...

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

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

In the system web key.

All the research I did I found no more reason not to work.

Would Anyone have any ideas, please?

Just 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 throwxception) +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, Appdomaincreationexception Exception) + 531

Author: Bacco, 2018-09-14

3 answers

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

<system.Web>
...
    <trust level="Full"/>
...
</system.Web>
 0
Author: Danizavtz, 2018-09-14 14:34:01

Using the trustlevel name="Full" attribute creates a conflict with the rows of the system key.codedom and these should be commented out of the Web.config

 0
Author: Sergio Di Fiore, 2018-09-14 18:10:18

There is no use adding Trust Level, trust name or something like that because it will block in the same way. In my case it was just remove the snippet 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
Author: Rafael Beck, 2019-05-23 01:54:43