SecurityException / IIS .Net Trust Levels / Diagnostic Traces

This dasBlog website is now being hosted at WinHost.  In reality, the migration was trivial.  Using IIS Manager, there is an option under Deploy to “Export Application…”which saves the entire site to a .zip file.  And then after connecting to the new site, one simply runs “Import Application…” and points to the saved .zip file—simple and easy.  Except that when navigating to the new site, one is greeted with an unfriendly:

Server Error in ‘/’ Application.



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.SecurityPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Source Error:


[No relevant source lines]

plus the detailed call stack…

The quick and dirty fix was to change the .Net Trust Level from High to Internal.





However, this just didn’t feel safe and after doing some searching on the web I found this great post on Useless Inc.  It appears that something in the process modified the web.config to add diagnostic tracing for OpenID. Just as Tomer Gabel did, I removed this section from the web.config

    <assert assertuienabled="false"/>
      <add name="OpenID" value="4"/>
    <trace autoflush="true" indentsize="4">
        <add name="fileLogger" type="System.Diagnostics.TextWriterTraceListener"
             initializeData="openidConsumerTrace.txt" traceOutputOptions="None"/>

and set the trace to false:

  <trace enabled=falsewriteToDiagnosticsTrace=truerequestLimit=1000pageOutput=falsetraceMode=SortByTimelocalOnly=false/>

and now this site is happily running…

Leave a Reply

Your email address will not be published. Required fields are marked *