Question

An error occurred while starting the application.

Posted February 14, 2020 1.5k views
Applications

Hi, I clicked ‘restart application’ in grandnode admin area,

Then, When I tried to access the web, the browser showed me:

An error occurred while starting the application.
.NET Core 4.6.27817.03 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687    |    Linux 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020    |   Need help?

but /var/aspnetcore/GrandNode/logs/stdout does not show any error. any idea what’s going on and how to fix this bug?.

I don’t see any bug on appsettings.json too

{
  "Hosting": {
    //Set to "true" the settings below if your hosting uses a load balancer. It'll be used to determine whether the current request is HTTPS
    "UseHttpClusterHttps": true,
    "UseHttpXForwardedProto": true,

    //Use the setting below if your hosting doesn't use "X-FORWARDED-FOR" header to determine IP address.
    //In some cases server use other HTTP header. You can specify a custom HTTP header here. For example, CF-Connecting-IP, X-FORWARDED-PROTO, etc
    "ForwardedHttpHeader": "",

    //Use a reverse proxy server - more information you can find at: https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1
    "UseForwardedHeaders": true
  },

  "Grand": {
    //Enable if you want to see the full error in production environment. It's ignored (always enabled) in development environment
    "DisplayFullErrorStack": false,

    //Value of "Cache-Control" header value for static content
    "StaticFilesCacheControl": "public,max-age=604800",

    //Indicates whether to compress response (gzip by default)
    //You may want to disable it, for example, If you have an active IIS Dynamic Compression Module configured at the server level
    "UseResponseCompression": false,

    //This settings adds the following headers to all responses that pass
    //X-Content-Type-Options: nosniff
    //Strict-Transport-Security: max-age=31536000; includeSubDomains
    //X-Frame-Options: Deny
    //X-XSS-Protection: 1; mode=block
    //Referrer-Policy: strict-origin-when-cross-origin
    //Content-Security-Policy: object-src 'none'; form-action 'self'; frame-ancestors 'none'
    "UseDefaultSecurityHeaders": true,

    //Flag for whether to enable html minification
    "UseHtmlMinification": false,

    //Load url rewrite rules from external file AppData/UrlRewrite.xml
    "UseUrlRewrite": false,
    "UrlRewriteHttpsOptions": false,
    "UrlRewriteHttpsOptionsStatusCode": 303,
    "UrlRewriteHttpsOptionsPort": 443,
    "UrlRedirectToHttpsPermanent": false,

    //HTTP Strict Transport Security Protocol
    "UseHsts": false,

    //We recommend all ASP.NET Core web apps call HTTPS Redirection Middleware to redirect all HTTP requests to HTTPS
    "UseHttpsRedirection": false,
    "HttpsRedirectionRedirect": 308,
    "HttpsRedirectionHttpsPort": 443,

    //Enable the session-based TempData provider
    "UseSessionStateTempDataProvider": false,

    //Web farm support.
    //Enable "MultipleInstancesEnabled" if you run multiple instances.
    //Enable "RunOnAzureWebApps" if you run on Windows Azure Web Apps (not cloud services)
    "MultipleInstancesEnabled": false,
    "RunOnAzureWebApps": false,

    //Windows Azure BLOB storage.
    //Specify your connection string, container name, end point for BLOB storage here
    "AzureBlobStorageConnectionString": "",
    "AzureBlobStorageContainerName": "",
    "AzureBlobStorageEndPoint": "",

    //Amazon Blob storage
    //<!--Available Region System Names can be found here http://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region -->
    "AmazonAwsAccessKeyId": "",
    "AmazonAwsSecretAccessKey": "",
    "AmazonBucketName": "",
    "AmazonRegion": "",

    //Redis support (used by web farms, Azure, etc). Find more about it at https://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/
    "RedisCachingEnabled": false,
    "RedisCachingConnectionString": "localhost",

    //You can get the latest version of user agent strings at http://browscap.org/
    "UserAgentStringsPath": "~/App_Data/browscap.xml",

    //Do not edit this element. For advanced users only
    "PluginsIgnoredDuringInstallation": "",

    //For developers - more info you can find at https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/
    //https://github.com/dotnet/roslyn/wiki/Roslyn-Overview
    "UseRoslynScripts": false,

    ///Enable minimal Progressive Web App.
    "EnableProgressiveWebApp": true,
    //CacheFirst = 0,
    //CacheFirstSafe = 1,
    //CacheFingerprinted = 2,
    Minimal = 3,
    //NetworkFirst = 4
    "ServiceWorkerStrategy": 3,

    //Use my request localization culture
    "UseRequestLocalization": false,
    "DefaultRequestCulture": "en-US",
    //sample list
    "SupportedCultures": [ "en-US", "pl" ],

    //Indicates whether to ignore startup tasks
    "IgnoreStartupTasks": false,

    //Enable if you want to clear /Plugins/bin directory on application startup
    "ClearPluginShadowDirectoryOnStartup": true,

    //Allow to recompiling views on file change
    "AllowRecompilingViewsOnFileChange": false,

    //Indicates whether to ignore InstallUrlMiddleware
    "IgnoreInstallUrlMiddleware": false,
    //Indicates whether to ignore UsePoweredByMiddleware
    "IgnoreUsePoweredByMiddleware": false
  },
  "Api": {
    "Enabled": false,
    "SecretKey": "your private secret key",
    "ValidateIssuer": false,
    "ValidIssuer": "",
    "ValidateAudience": false,
    "ValidAudience": "",
    "ValidateLifetime": true,
    "ValidateIssuerSigningKey": true,
    "ExpiryInMinutes": 1440,
    //generate system model
    "SystemModel":  true
  }
}
edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @nurblissempire,

Are you sure this file should be a .json file?
To me, it looks like this would be a .js, JavaScript, file.

JSON as a format doesn’t support commnets in the file (// This is a comment) or for keys that aren’t strings, such as the Minimal = 3, that you have.

- Matt.

Submit an Answer