ASP.NET con IIS 7.5 y Plesk 9.3
Ya está disponible la nueva versión del panel de control de Plesk que es totalmente compatible con ASP.NET. Con esta nueva versión del famoso panel de control hemos detectado que, a la hora de tratar de instalar Plesk 9.3 sobre Windows Server 2008 R2, se produce un error. Este fallo nos alerta de que»ASP.NET no está autorizado para acceder al recurso solicitado» (is not authorized to access the requested resource).
El error que se nos muestra es el siguiente:
Server Error in '/mssql' Application. -------------------------------------------------------------------------------- Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 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.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access. 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: [UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))] [FileLoadException: Could not load file or assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.] 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 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +57 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 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.] 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 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8897659 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333
¿Cómo podemos corregir el error de ASP.NET?
El error se podía reproducir al tratar de ejecutar una aplicación desde el panel de control Plesk. En nuestro caso, el fallo se producía cada vez que tratábamos de lanzar el administrador web para bases de datos SQL Server ASP.NET Enterprise Manager. Aunque también se puede mostrar este error al intentar ejecutar MyLittleAdmin desde el panel Plesk.
Si tratamos de corregir el error desde la herramienta Plesk Reconfigurator no conseguiremos solucionar el problema. Esto se debe a que los permisos necesarios para resolverlo, no están añadidos. Por ello, tendremos que añadir estos permisos a mano.
Lo único que tenemos que hacer es editar el archivo DiskSecurity.xml que podemos encontrar dentro de la carpeta %PLESK_DIR%etcDiskSecurity. A este archivo tendremos que añadirle el siguiente contenido dentro del tag Entries:
<!-- Permisos a Assembly para ASP.NET Enterprise manager --> <Entry AccounType="1" Account="Psacln" Path="C:Windowsassembly" AceFlags="FilesOnly" AccessMask="Read" EntryFlags="0x0" /&>
Finalmente hay que ejecutar el siguiente comando en bash, de forma que se apliquen los cambios necesarios en los permisos:
"%plesk_bin%applysecurity" --apply
Recuerda que en Linube disponemos de servicios especialmente diseñados para ASP.net MVC y PHP bajo Windows para facilitar el funcionamiento de tus proyectos Windows y optimizarlos al máximo.
Aunque pueda parecer contradictorio, debido a los distintos errores que hemos tenido que subsanar, desde Linube te aconsejamos tener siempre SQL Server actualizado, así como el resto de componentes instalados en el servidor.