Open Closed

Project deploy on IIS #6145


User avatar
1
faisalhz created
  • ABP Framework version: v7.3.3
  • UI Type: MVC
  • Database System: EF Core (SQL Server) /
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

I'm trying to deploy my MVC project on IIS. I did the following steps:

  1. I created a certificate as shown here: https://docs.abp.io/en/abp/latest/Deployment/Configuring-OpenIddict
  2. I put the certificate inside the published folder
  3. I created a site on IIS. The type: http, IP address:* Port: 44396

appsettings.json file:

{
  "App": {
    "SelfUrl": "http://localhost:44396",
    "DisablePII": "false",
    "HealthCheckUrl": "/health-status"
  },
  "ConnectionStrings": {
    "Default": "--deleted"
  },
  "Elsa": {
    "Server": {
      "BaseUrl": "http://localhost:44396"
    },
    "Smtp": {
      "Host": "localhost",
      "Port": "2525",
      "DefaultSender": "noreply@acme.com"
    }
  },
  "EmailServer": {
    "ApiURL": "http://localhost:7061/api/email/send"
  },
  "AuthServer": {
    "Authority": "http://localhost:44396",
    "RequireHttpsMetadata": "false"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "--deleted"
  }
}

When I go to http://localhost:44396/ I get the following error:

HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
* The app failed to start
* The app started but then stopped
* The app started but threw an exception during startup
Troubleshooting steps:
* Check the system event log for error messages
* Enable logging the application process' stdout messages
* Attach a debugger to the application process and inspect

web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\ElsaDemo.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <remove name="x-powered-by" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>

Event viewer error log:

[14:55:52 INF] Starting web host.
[14:55:52 FTL] Host terminated unexpectedly!
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule, Volo.Abp.OpenIddict.AspNetCore, Version=7.3.3.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
 ---> System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
   at System.Security.Cryptography.X509Certificates.CertificatePal.FilterPFXStore(ReadOnlySpan`1 rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
   at System.Security.Cryptography.X509Certificates.CertificatePal.FromBlobOrFile(ReadOnlySpan`1 rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
   at ElsaDemo.Web.ElsaDemoWebModule.GetSigningCertificate(IWebHostEnvironment hostingEnv, IConfiguration configuration) in C:\Users\--deleted\source\repos\ElsaDemo\src\ElsaDemo.Web\ElsaDemoWebModule.cs:line 396
   at ElsaDemo.Web.ElsaDemoWebModule.<>c__DisplayClass0_0.<PreConfigureServices>b__3(OpenIddictServerBuilder builder) in C:\Users\--deleted\source\repos\ElsaDemo\src\ElsaDemo.Web\ElsaDemoWebModule.cs:line 131
   at Volo.Abp.Options.PreConfigureActionList`1.Configure(TOptions options)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionPreConfigureExtensions.ExecutePreConfiguredActions[TOptions](IServiceCollection services, TOptions options)
   at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.&lt;&gt;c__DisplayClass1_0.&lt;AddOpenIddictServer&gt;b__0(OpenIddictServerBuilder builder)
   at Microsoft.Extensions.DependencyInjection.OpenIddictServerExtensions.AddServer(OpenIddictBuilder builder, Action`1 configuration)
   at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.AddOpenIddictServer(IServiceCollection services)
   at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.ConfigureServices(ServiceConfigurationContext context)
   at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context)
   at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
   --- End of inner exception stack trace ---
   at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
   at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
   at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction)
   at ElsaDemo.Web.Program.Main(String[] args) in C:\Users\--deleted\source\repos\ElsaDemo\src\ElsaDemo.Web\Program.cs:line 36

1 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi, Have you created authserver.pfx file and placed it in Web Package ? Have you set Load User Profile to true in IIS Once check whether, IISUSER has read and write permissions to the publish folder (Try giving Full Control) Once check this link - https://support.abp.io/QA/Questions/4845/How-to-install-app-on-IIS-having-issues-with-Cryptography

    Thanks

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38