Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
Hello, i just created the example of web api in vs 2019 (the weather),
I just published it (after tons of errors) but when i use the IIS server and browser it: Only the list of files on the folder is displayed, not the page with the temparautes.
But if you run the web api in vs 2019 everything is as expect it.
Any Help?

What I have tried:

I just uninstall de IIS and reinstalled it. I have windows 11.
I just add the aspnetcoremodule manually on the ISS.
Posted
Updated 9-Aug-22 18:38pm
Comments
Laiju k 22-Nov-22 0:15am    
I have the same sorta problem

https://www.codeproject.com/Questions/5347410/When-browse-ASP-NET-core-web-API-from-IIS-this-err

1 solution

Normally, this kind of web-related-it-works-in-dev-but-fails-in-prod problem is down to one of two things:
1) User / permissions. In dev, you C# code runs as you on your machine, and can access anywhere you can. In prod, it runs under a specific user for IIS, and it's permissions are very restricted - pretty much only the folder that your code is located in and it's subfolders are accessible at all!

2) Assuming that C# and JS code run on the same machine: they don't. C# code runs on the server and can only access files and devices connected directly to that machine and it's local LAN. JS code runs on the client and can only access a limited part of that machine via the browser.
In dev, that works OK because both machines are the same physical computer. In prdo the two computers could be thousands of mines apart!
For example, a MessageBox in C# code looks fine in dev, but in prod it is shown on the Server where the client can see it, and can't respond to it even if he guesses it should be there.

We don't have any access to your code, so we can't tell you how to fix it: you will have to fall back on an old form of debugging: add logging code to show you what is actually happening in production, and review the logs after the problem has occurred. Refine your logs to "narrow down" the problem, and repeat until you can work out what is happening when it shouldn't, or not happening when it should.

Sorry, but we can't do any of that for you!
 
Share this answer
 
Comments
Laiju k 22-Nov-22 0:19am    
Have you just give me a redirection or link to properly hosting Asp . Net Core WEB API in IIS.

I checked for two days but not much of success.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900