locked
VS 2013 - Error when calling web site after publish RRS feed

  • Question

  • User-2060727494 posted

    After I publish my ASP.Net web site built using Visual Studio 2013 Express, I get this error:

    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.

    I assume I have to add something to my web.config file.  But not sure what to add.  Any ideas on how to fix this?

    Thursday, July 10, 2014 12:16 PM

Answers

  • User-2060727494 posted

    I figured it out.  My original web site was created using VS 2008.  I created a new web site using VS 2013.  So I deleted everything from the GoDaddy server and published again.  Now it works.  Some old objects must have been causing security issues.  Works great now.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 11, 2014 7:08 AM

All replies

  • User-718146471 posted

    The setting you need to add to the web.config is full trust.  Here is some background on how to do that:

    <trust 
       hostSecurityPolicyResolverType ="security policy resolution type"
       legacyCasModel = "[True|False]"
       level="[Full|High|Medium|Low|Minimal]" 
       originUrl="URL"
       permissionSetName = "name of the permission set"
       processRequestInApplicationTrust = "[True|False]" 
    />
    
    

    It goes under

    <Configuration>
        <system.Web>
                <Trust>
                 ......

    For some additional light reading: http://msdn.microsoft.com/en-us/library/vstudio/tkscy493(v=vs.100).aspx

    Thursday, July 10, 2014 12:27 PM
  • User-2060727494 posted

    Thanks for the reply.  I added this to my web.config but I get the same error:

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

    I don't remember doing any of this when I published from VS 2008.  That web site project was accidentally destroyed, source code and all.  So I created a new web site project using VS 2013.  Not sure I understand what all I need for the <trust>.  What is wrong with the above?

    Thursday, July 10, 2014 1:46 PM
  • User-718146471 posted

    Did you read over the link I sent you?  If you uploaded your code to a new server, that server may not be permitting you a high enough trust level to execute.  Are you running this locally or on a server when you see this?  Is it hosted internally or an outside website host?  If external, who is the host?

    Thursday, July 10, 2014 1:50 PM
  • User-2060727494 posted

    GoDaddy is my hosting company.  The web site worked until I published the new version from VS 2013.  I don't think I have access to IIS on the GoDaddy server.  I also did not have this <trust> in my old VS 2008 web.config file.  The web site works fine on my local PC btw.

    Thursday, July 10, 2014 1:57 PM
  • User-718146471 posted

    I recall having this problem at one point because GoDaddy changed their system.  I think you can change the trust level in the control panel; give GoDaddy an email as I'm sure they can speak to this.  This is why I switched to Arvixe because they are very limiting on what they do and do not allow.  They even shut down the application pools if the site is not accessed on a regular basis; that stinks for asp.net web apps.

    Thursday, July 10, 2014 2:01 PM
  • User-718146471 posted

    This article from GoDaddy should help you work this out: http://support.godaddy.com/help/article/2531/what-trust-level-can-i-use-when-running-asp-net

    Thursday, July 10, 2014 2:04 PM
  • User-2060727494 posted

    Thanks bb.  I keep moving forward but getting new errors each time.  Now I get this error:

    The assembly 'AjaxControlToolkit, Version=4.1.51116.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource that has the name 'respond'. Make sure that the resource name is spelled correctly.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The assembly 'AjaxControlToolkit, Version=4.1.51116.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource that has the name 'respond'. Make sure that the resource name is spelled correctly.

    I'm not even using AJAX in my web site.  At least not yet.  I have not even added the reference to AJAX.  Or does VS 2013 automatically add a reference to AJAX?

    Thursday, July 10, 2014 3:14 PM
  • User-2060727494 posted

    There is a version of AJAX toolkit on the GoDaddy server.  Let me remove this and see if it works.

    Thursday, July 10, 2014 3:17 PM
  • User-2060727494 posted

    I removed the AJAX toolkit and I now get this error:

    The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'respond'. Make sure that the resource name is spelled correctly.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'respond'. Make sure that the resource name is spelled correctly.

    Not sure what this means.  Can anyone help?

    Thursday, July 10, 2014 3:26 PM
  • User311508580 posted

    After I publish my ASP.Net web site built using Visual Studio 2013 Express, I get this error:

    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.

    I assume I have to add something to my web.config file.  But not sure what to add.  Any ideas on how to fix this?

    Hi bob,

    Have you ask your hosting provider to grant full permission for you? This is the permission issue. If you have given full permission to your site, then I believe that your site will run fine

    Thursday, July 10, 2014 11:18 PM
  • User-2060727494 posted

    Thanks for the reply.  GoDaddy is my hosting company.  They provided me this link:

    http://support.godaddy.com/help/article/2531/what-trust-level-can-i-use-when-running-asp-net

    I then clicked on their control panel link.

    So I added this line to my VS 2013 web.config file:

    <trust level="Full" />

    But I still get the error.

    Friday, July 11, 2014 6:37 AM
  • User-2060727494 posted

    I figured it out.  My original web site was created using VS 2008.  I created a new web site using VS 2013.  So I deleted everything from the GoDaddy server and published again.  Now it works.  Some old objects must have been causing security issues.  Works great now.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 11, 2014 7:08 AM