locked
Need help deploying exsisting ASPX site to new server - New to ASP.NET sites RRS feed

  • Question

  • User-291083441 posted

    I am brand new to any and all types of Windows-based site development so please bear with me.

    Site containing errors: http://a-1door.com.108-167-179-91.secure19.win.hostgator.com

    I have read through these errors and I somewhat understand what they are trying to tell me. I know that I have to correct some required permissions with some other file. but I do not know how to do so.

    I have WebMatrix installed so if I need to fix the permissions I am comfortable editing within WebMatrix.

    Here's what errors I get when I Deployed and previewed this site:

    Server Error in '/' Application.


    Required permissions cannot be acquired.

    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.Security.Policy.PolicyException: Required permissions cannot be acquired.

    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: 

    [PolicyException: Required permissions cannot be acquired.]
       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +7608739
       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57
    
    [FileLoadException: Could not load file or assembly 'IKVM.Runtime, Version=0.18.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
       System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
       System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
       System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    
    [ConfigurationErrorsException: Could not load file or assembly 'IKVM.Runtime, Version=0.18.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
       System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
       System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +232
       System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337
    
    [HttpException (0x80004005): Could not load file or assembly 'IKVM.Runtime, Version=0.18.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729
    
    [HttpException (0x80004005): Could not load file or assembly 'IKVM.Runtime, Version=0.18.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8921851
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333

    Thursday, December 27, 2012 2:13 PM

Answers

  • User-166373564 posted

    Hi Jchapman

    Sorry for the issue that you are hitting.

    In general this exception happens because your assembly is requesting permissions that IIS cannot grant.

    You could also have a try set, view, change, or remove special permissions for files and folders(http://support.microsoft.com/kb/308419#4)

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 2, 2013 2:07 AM
  • User-1404016747 posted

    my partner setup the new windows server

    I take it you have a dedicated server now?
    If so check your event log in Windows to see if an actual error message which may be of use is present there.
    500 errors are so vague and could be caused by so many things it is hard to troubleshoot without knowing more details.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 2, 2013 6:58 AM

All replies

  • User-1555788080 posted

    Hi Jchapman65,

    Could not load file or assembly 'IKVM.Runtime, Version=0.18.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58'

    Either the above mentioned assembly does not exists on the server or its dependencies does not exists OR it is present at a location where application does not have an access. Easy resolution: Copy-paste the IKVM.Runtime, Version=0.18.0.0 in your websites bin folder. You have to make sure that exact version referenced in your application is available and accessible.

    Thursday, December 27, 2012 5:24 PM
  • User-1404016747 posted

    Sounds like you need to adjust the trust level to a higher level in IIS.

    Take a look at this to learn how to do so:
    http://technet.microsoft.com/en-us/library/cc753658

    If the new host is a third party hoster you may need to contact them to see if they are willing to make the change for you. If they are not you will need to go through your application and rework the application to work in a medium trust level environment which some third party hosts impose. That or find a host willing to allow your application to run with full trust as many do.

    Here is a little more information on trust levels:
    http://technet.microsoft.com/en-us/library/cc772237

    Thursday, December 27, 2012 5:30 PM
  • User-291083441 posted

    @PrashanthReddy: 

    IKVM.Runtime.dll already exsists inside the bin folder, along with IKVM.GNU.Classpath.dll. Those are the only files with IKVM mentioned in the bin folder. but what exactly do I do with this file, you just said to copy-paste, but since it's already in the bin folder, what else do I do? Also how do I check that the version is 0.18.0.0? what program should I use?

    @jprochazka:

    I only have to ability to connect via FTP so I'll have to get back on you with raising the trust level via server side. Also how do I check what trust level my website is asking for?

    Thursday, December 27, 2012 8:05 PM
  • User-1555788080 posted

    Hi Jchapman65,

    Generally we encounter a Security PolicyException while debugging or compiling a .net project, application is trying to access an assembly or service it does not have permission to. Thus it could be related to the System.web trust level in the web.config file. 

    Find <system.web> and include below settings.

    <system.web>
    <securityPolicy>
    <trust level="Full" originUrl="" />
    </securityPolicy>

    For reference

    http://msdn.microsoft.com/en-us/library/tkscy493%28v=vs.100%29.aspx

    Friday, December 28, 2012 6:01 AM
  • User-291083441 posted

    My Web.config didn't have a <securityPolicy> under <system.Web>. So I put one in an now I get a new error. I tried both Medium and Full level but it's the same error. I'm still trying to find out what level my thrid party server is set to.

    Server Error in '/' Application.


    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

    Parser Error Message: This configuration section cannot be used at this path.  This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

    Source Error: 

    Line 75:       <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" />
    Line 76:     </httpModules>
    Line 77: <securityPolicy> Line 78:         <trust level="Medium" originUrl="" />
    Line 79:     </securityPolicy>
    Friday, December 28, 2012 9:03 AM
  • User-1404016747 posted

    Your host is forcing the application to run in a medium trust environment and has explicitly blocked apps from running at a hight trust level thats why adding the line caused the error you are encountering now. As I stated before since you do not have control over setting the trust level on the server it looks like you have three options.

    1) Contact your host to see if they will set up your application to run in full trust.
    2) Find a host which offers it's clients full trust hosting. (there are many out there)
    3) Rewrite or remove the offending code. (the code requiring a higher trust level in order to execute)

    Good luck.

    Edit:
    I noticed the link you added to your original host pointed to HostGator as your hosting provider.
    This was found on HostGator's support site reguarding full trust:

    Do the applications run in ASP.NET full trust security level?

    No. The applications must be published in Medium Trust in order to run on the Windows Shared Server.

    So it would seem option 2 or 3 is your only route.

    Friday, December 28, 2012 1:50 PM
  • User-291083441 posted

    Thank you so much, I'm in the process of switching hosting servers and also would like to know one more thing: If I chose ASP.NET 4.0 as an option, will it also support ASP.NET 2.0?

    Friday, December 28, 2012 2:58 PM
  • User-1404016747 posted

    Cool deal. Just make sure you check with who ever is going to host the application for you that it can run at full trust.

    You can have a site running a v4.0 application and then run a v2.0 application in a subdirectory within the parent v4.0 application however the child application will need to be converted into a separate application and run in a different application pool using the v2.0 framework. This again is something you will have to ask your hosting provider to do if this is something you will need.

    If the application you are currently trying to run is a v2.0 and you would like to run it as a v4.0 application you can try upgrading it in Visual Studio. This is generally a painless process unless your application uses any depreciated code or referances third party assemblies which do not offer a v4.0 version of them.

    Honestly I would set it to whatever version your current application is running and if you are looking to upgrade to v4.0 in the future have the host change this once you are ready to deploy the new version.

    Friday, December 28, 2012 3:10 PM
  • User-291083441 posted

    I went with arvixe.com and my partner setup the new windows server, set up a new domain and uploaded the same files to this new server, which has Full Trust levels...and now I am getting a 500 internal server error...

    at this point I'm very confused...I have cleared all cache and cookies, used every browser known to man, re uploaded twice, reset trust levels from low to high to, currently, Full. I have disabled PHP5. The new site is set to ASP.NET 2.0, the code the site is made of, and still 500 internal server error. I dont know what else to do. What else can I do?

    Friday, December 28, 2012 8:30 PM
  • User-166373564 posted

    Hi Jchapman

    Sorry for the issue that you are hitting.

    In general this exception happens because your assembly is requesting permissions that IIS cannot grant.

    You could also have a try set, view, change, or remove special permissions for files and folders(http://support.microsoft.com/kb/308419#4)

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 2, 2013 2:07 AM
  • User-1404016747 posted

    my partner setup the new windows server

    I take it you have a dedicated server now?
    If so check your event log in Windows to see if an actual error message which may be of use is present there.
    500 errors are so vague and could be caused by so many things it is hard to troubleshoot without knowing more details.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 2, 2013 6:58 AM