ASP.NET MVC Acces Denied (Retrieving the COM class factory for component with CLSID)

0

i have this error who came out when i click on a button to call by jquery post a function in my controller:

JS code:

 $.post("/generer", {
            lieu: $("#lieu").val(),
            date: $("#date").val(),
            grade: $("#grade").val(),
            nom: $("#nom").val(),
            peloton: $("#peloton").val(),
            objet: $("#objet").val(),
            first_para: $("#first_para").val(),
            second_para: $("#second_para").val(),
            ordre: $("#ordre").val()
        }).done(function (data) {
            if(data != "Erreur")
            {
                file = data;
                $("#centerdiv").css("display", "none");
                $("#div_m").css("display", "block");
            }
            else { alert(data);}
        });
    }

The C# function i call in my controller just open un word file to enter in bookmarks all the data i get in my js script. I have a RouteConfig file:

 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Home",
            url: "",
            defaults: new { controller = "Home", action = "Index" }
        );



        routes.MapRoute(
            name: "Generer",
            url: "generer",
            defaults: new { controller = "Home", action = "CreateDoc" }
        );

        routes.MapRoute(
            name: "SendMail",
            url: "mail",
            defaults: new { controller = "Home", action = "SendMail" }
        );

In debug via VS it works fine but when i publish the website in IIS the first page loaded (its a form basically) but when i click on the button who call the js function above i get in the browser console the error:

POST http://localhost:88/generer 500 (Internal Server Error)

And when i click on this link i get this error:

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 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: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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 File 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.

i tried to give permissions but i dont really know to which user i have to give the permissions.

I also noticed when i publish this project not all the files and folders copy in wwwroot. Contrary to my other project who all the files and folders are copied to wwwroot. including routeconfig the controllers files etc... Not for this project i dont know why

c#
asp.net
iis
model-view-controller
asked on Stack Overflow Jun 16, 2018 by chuckdu21 • edited Jul 6, 2020 by Martijn Pieters

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0