proudmonkey/ApiBoilerPlate

When I run the project I get the error in browser (HTTP Error 500.24)

Closed this issue · 11 comments

I have installed the template form extensions menu of visual studio and created a new project. I also created a table in my database and updated the connection string in appSettings.json file. when i run the project i see the following error in my browser as shown in the image.

HTTP Error 500.24 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Most likely causes:
system.web/identity@impersonate is set to true.

Things you can try:
If the application supports it, disable client impersonation.
If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation@validateIntegratedModeConfiguration to false.

Capture asp netboilerplate error

Thank you for trying out the template. I can see that the error you are getting is related to your application configuration. What version of .NET core you are using? Note that the latest version of the template uses .NET Core 3.1.

I would recommend you to post your issue at tech forums such as stackoverflow or forums.asp.net as well.

I am using netcoreapp3.1,
I was able to run the template successfully by following these instructions.

But i think that the Web.config file should preexist in the template so that any one else should not have to face this problem.

the template should work fine without that configuration. I have tested it. I'm assuming it has something to do with IIS config. Check this out: https://stackoverflow.com/questions/54727477/http-error-500-24-internal-server-error-system-web-identityimpersonate-is-s/60340688#60340688

Also have you also tried running it in Kestrel instead of IIS Express?

I did not published the website. i only created the project and than clicked run (hit F5) and the above error popped up. (I did have installed the iis on my laptop but i think that it has nothing to do with the visual studio and iis express )

I tried the steps in this post but they did not helped me.

What happen if you run using Kestrel and not IIS Express? Also how do you connect to your database? have you tried creating a database using localdb? Can you show your appsettings.json file?

I have not changed the default settings for server and by default it is iis express(i guess).

I have not tried the localdb

I have installed sql server and i updated the appsettings.json file by changing the connection string.
following is my appsettings.json file ( I only changed the SQLDBConnectionString )

{
  "ConnectionStrings": {
    "SQLDBConnectionString": "Data Source=.;Initial Catalog=tmp;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
    "PostgreSQLConnectionString": ""
  },
  "AllowedHosts": "*",
  "Self": {
    "Id": "api.boilerplate.core",
    "Secret": "0a2e472b-f263-43fd-8372-3b13f5acf222"
  },
  "ApiResourceBaseUrls": {
    "AuthServer": "https://localhost:5000",
    "SampleApi": "https://localhost:4500"
  },
  "HttpClientPolicies": {
    "RetryCount": 3,
    "RetryDelayInMs": 500,
    "RetryTimeoutInSeconds": 5,
    "BreakDurationInSeconds": 30,
    "MaxAttemptBeforeBreak": 3,
    "HandlerTimeoutInMinutes": 5
  },
  "IpRateLimiting": {
    "EnableEndpointRateLimiting": true,
    "StackBlockedRequests": false,
    "RealIpHeader": "X-Real-IP",
    "ClientIdHeader": "X-ClientId",
    "HttpStatusCode": 429,
    "GeneralRules": [
      {
        "Endpoint": "*:/api/*",
        "Period": "1s",
        "Limit": 2
      }
    ]
  },
  "HealthChecksUI": {
    "HealthChecks": [
      {
        "Name": "HTTP-Api-Basic",
        "Uri": "https://localhost:5001/selfcheck"
      }
    ],
    "Webhooks": [
      {
        "Name": "",
        "Uri": "",
        "Payload": "",
        "RestoredPayload": ""
      }
    ],
    "EvaluationTimeInSeconds": 10,
    "MinimumSecondsBetweenFailureNotifications": 60,
    "HealthCheckDatabaseConnectionString": "Data Source=Infrastructure\\HealthChecks\\Db\\healthchecksdb"
  }
}

It really doesn't make sense to me to use web.config for .NET Core apps. Can you try the following connectionString?

"ConnectionStrings": {
   "SQLDBConnectionString": "Server=<YOUR SQL SERVER NAME>;Database=<YOUR DATABASE NAME>;Trusted_Connection=True;"  
}

Also, I don't think the issue is directly related to this template. Have you tried creating a new ASP.NET Core API project without using this template and connect to your SQL Server instance? Try that and see if you can connect outside localdb.

i am using appsettings.json file shared above for connection string.

"ConnectionStrings": {
    "SQLDBConnectionString": "Data Source=.;Initial Catalog=tmp;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
    "PostgreSQLConnectionString": ""
  },

I am not using web.config for connection string.

Yes and you are getting error with that right? The example connectionstring from the template uses localdb and you are not. The web.config settings that fixed your error is what I'm referring to and I'm not suggesting to use web.config for connectionString.