Asp.Net Core API published. Default page getting 500 error but Weatherforcast api working in Postman.

Jithesh k r 26 Reputation points
2022-02-11T05:05:45.03+00:00

Asp.Net Core Api published in IIS.
default page swagger/index.html not working and Login modules not working. but Weatherforcast api working in Postman. Please help.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,617 questions
{count} votes

Accepted answer
  1. Rijwan Ansari 751 Reputation points MVP
    2022-02-11T09:00:58.247+00:00

    Hi @Jithesh k r

    I think this is because of environment.

    // Configure the HTTP request pipeline.  
    if (app.Environment.IsDevelopment())  
    {  
        app.UseSwagger();  
        app.UseSwaggerUI();  
    }  
    

    You can keep swagger UI call outside of development environment.

    Try this way and check

    // Configure the HTTP request pipeline.  
    if (app.Environment.IsDevelopment())  
    {  
          
    }  
    app.UseSwagger();  
    app.UseSwaggerUI();  
    
    0 comments No comments

9 additional answers

Sort by: Most helpful
  1. Jithesh k r 26 Reputation points
    2022-02-11T10:49:56.877+00:00

    thanks. resolved the issue.
    I used the connection string as Integrated secuity = True. When I changed to Sql Authentication, it's worked.
    Once again thanks..

    1 person found this answer helpful.

  2. Jithesh k r 26 Reputation points
    2022-02-11T08:18:25.043+00:00

    Whether this error happens in the local environment? No. Local environment it's working fine.
    But when I publish to the local IIS, it's not working.
    the same IIS url when I called in Postman, wheatherforcast api is working.
    Other default swagger/index.html and Authenticate api's are not working. please help.

    0 comments No comments

  3. Jithesh k r 26 Reputation points
    2022-02-11T09:31:41.047+00:00

    thanks. When I manually added the "swagger/index.html" the page is showing without error.
    The main issue is still remain. The /api/Authenticate/register getting 500 error.
    Please help


  4. Jithesh k r 26 Reputation points
    2022-02-11T09:56:58.17+00:00

    while making the API call getting 500 error

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.