none
Applikation auf Server von ASP.NET aus ausführen RRS feed

  • Frage

  • Hallo zusammen,

    ich möchte gerne aus einer ASP.NET Anwendung heraus eine Applikation auf einem Server (Windows Server 2008 R2) starten. Diese Applikation führt ein Script auf dem Server aus und wird danach wieder geschlossen. Meine ASP Anwendung läuft auf einem IIS 7. Damit der IIS User die Berechtigung hat, die App auch auszuführen, habe ich der Gruppe IIS_IUSRS volle Zugriffsberechtigung auf das Installationsverzeichnis der Applikation gegeben.

    Dann bekomme ich folgenden Fehler:

    Retrieving the COM class factory for component with CLSID {2B9B8E92-EBAA-44AF-A23C-9FBD08EAFA54} 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 {2B9B8E92-EBAA-44AF-A23C-9FBD08EAFA54} 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 <identity impersonate="true"/>, 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.


    Auch wenn ich "ASP.NET Impersonation" für meine Applikation einschalte und als User den Administrator angebe, bekomme ich einen Fehler:

    Creating an instance of the COM component with CLSID {2B9B8E92-EBAA-44AF-A23C-9FBD08EAFA54} from the IClassFactory failed due to the following error: 80070005.

    Die Beschreibung des Fehlers inst ansonsten die Gleiche. Irgendwie fehlt die Berechtigung für das erstellen eines COM Objekts.

    Bitte um Hilfe.

    Grüsse,

    kaktus

    Donnerstag, 29. März 2012 07:55

Antworten

  • Erstelle einen user für deinen App Pool und benutze diesen für deine Webseite. Füge diesen User der IIS_Users Group hinzu und gebe der IIS_Users Group explizit Rechte auf diese Datei.


    Freitag, 13. April 2012 08:24

Alle Antworten

  • Erstelle einen user für deinen App Pool und benutze diesen für deine Webseite. Füge diesen User der IIS_Users Group hinzu und gebe der IIS_Users Group explizit Rechte auf diese Datei.


    Freitag, 13. April 2012 08:24
  • Hallo Francesco,

    viele Dank für deine Antwort.

    Habe dem App Pool den Administrator zugewiesen (der ja auf alle Dateien Zugriff haben sollte). Habe den Admin sogar der IIS_Users Group hinzugefügt. Bekomme immer noch den gleichen Error.

    Welche Datei es genau ist weiss ich eben nicht. Ich will ja nicht eine einzelne Datei ausführen sondern eine Applikation starten.

            Dim qtApp As QuickTest.Application
            qtApp = New QuickTest.Application 'hier kommt der Error
            qtApp.Launch()
            qtApp.Quit()
    Grüsse kaktus
    Freitag, 13. April 2012 11:42
  • Hi,

    da Du das ja woanders schon mal gefragt hast, hier noch eine Nachfrage: Zeigt die aufzurufende Anwendung irgendeine Oberfläche an? Und sei es nur eine MessageBox, ...? Falls ja: Geht nicht* IIS ist ein Dienst, der kann mit sowas nichts anfangen. Daher wirst Du nicht umhin kommen, das in eine Konsolenanwendung umzuschreiben und jegliche Oberflächeninterkation zu unterdrücken.

    * Irgendwie geht natürlich alles. Es ist aber extrem umständlich, fehleranfällig und eine Garantie, dass es wirklich funktioniert, gibt es nicht, da das von vielen Faktoren abhängt.

    Generell hat deine Frage mit den Berechtigungen eher mit dcomcnfg zu tun. Dort musst Du dir deine Komponenten raussuchen. Welche das sind, musst Du anhand der Fehlermeldungen und ggfs. der Eventlog Einträge rausfinden, wenn Du keine Dokumentation der Anwendung hast.


    Gruß, Stefan
    Microsoft MVP - Visual Developer ASP/ASP.NET
    http://www.asp-solutions.de/ - Consulting, Development
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community

    Freitag, 13. April 2012 21:31
    Moderator
  • Hallo,

    die Applikation bringt eine API mit sich, mitwelcher die gesamte App gesteuert werden kann.

    Ich könnte die App via

    qtApp.Visible = True

    anzeigen lassen. Mache ich aber nicht. Der Error tritt ja auch bereits beim erstellen des Objekts auf.

    Zu diesem Zeitpunkt ist die App noch gar nicht gestartet.

    Mittwoch, 18. April 2012 08:25