C# WebApi This localhost page can’t be found - c#

recently I create one project webapi, platform ubuntu 22.04, so I'm using visual studio code to runn it, pressing f5, but I'm getting this issue:
This localhost page can’t be found
No webpage was found for the web address: http://localhost:5166/
HTTP ERROR 404
this is the file configuration:
what's wrong??

Related

Template ASP.NET with the React template on IIS - error 404

I built and published the application using this instruction: https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-react?view=vs-2022
I used two projects: "React" and "API asp.net" Visual Studio templates.
Chose publish ASP.NET Core project to the folder. Moved the application to a local IIS server and created a website.
Before publishing, I corrected the URL of the 'target' parameter to React to the URL of the website. Perhaps there is a wrong action here.
As a result,
"http://localhost" response with code 404
"http://localhost/weatherforecast" response 200 with JSON
How to configure the application to run on the IIS server?
I'm trying to find material on this topic, but without results.

How to resolve a 404 error for a asp.net web api deployed to a local file

So I have a web api project that runs perfectly locally (swagger page opens up) however when I deploy it to a local file and try to run it through IIS I get a 404 page error. I’ve looked through several documents but can’t seem to find a fix for this issue
These are the swagger options and when you deploy your site must change "SwaggerEndPoint".

Unable to Debug or launch my MVC application in chrome

I'm trying to launch my asp.net mvc sample application(c#) in chrome using visual studio but gives me the below error:
ERROR:
This site can’t be reached localhost refused to connect.
Search Google for localhost 49226
ERR_CONNECTION_REFUSED
I tried changing the port number didn't work.
Can anyone please guide me through this.
Thanks,
Akarsh
Re-install IIS and re-run your app:
https://www.microsoft.com/ru-RU/download/details.aspx?id=48264

Why ASP.NET Project Gives HTTP Error 500 When Launched Through IIS 7

I'm writing an ASP.NET Web Forms project in Visual Studio 2013, but am having trouble moving it to my computer's IIS 7. Although the project launches successfully from Visual Studio and works properly, launching the version I put on IIS gives an HTTP 500 error: "localhost is currently unable to handle this request."
Here is my process:
Use the File System method of Visual Studio's Publish tool to publish the project to a folder on my computer.
Access IIS' Default Web Site, and set the Physical Path to the folder I published the application to.
If the project works from Visual Studio, why wouldn't it work in IIS?
I had a double entry for in my web.config, and it was causing the same issue: 500 error with no other clue.
The problem was I was submitting a Web Form Application instead of a regular Web Site. The former has additional files in it that makes it not work properly in IIS (at least, I've never been able to make it work).
Thankfully, making a blank Web Site in Visual Studio and copying the web pages over from the Web Forms application was a simple matter, and I got it working easily.
I had an entry made in the web.config
which caused this error...remove the line fixed this issue. so probably any error in web.config makes the browser to not load the server and hence the issue

Default mvc/webapi site works in IIS Express but not in IIS 7.5

I've googled and searched stackoverflow, the following were not helpful
RESTFul service works in IIS Express / VS2013 but not on IIS Server
- the hot fix when run says "The update is not applicable to your computer."
Different result in IIS express and IIS
- not running dotnetnuke or webmatrix
running Win7Pro, with IIS7.5 Have VS2013Pro udpate 3 installed, had VS14CTP installed but is now uninstalled.
Create a new project, chose Web Application, MVC+WebApi, have WebApi 2.2 installed via nuget.
Make no changes to app, hit F5, app starts in chrome, see default ASP.NET site with a link to home and api. Clicking the Api link takes you to a help page describing the api calls available.
Publish site to file system, create new IIS website, point site to published folder, add defaultAppPool user to folder. browse to site from within IIS Manager. Site displayes but no styles are displayed. Setup site as machinename:80 also tried machinename:50102. Not using SSL or any authentication.
In chrome console there are 3 errors (this does not happen in IISExpress)
Uncaught SyntaxError: Unexpected token < modernizr:1
Uncaught SyntaxError: Unexpected token < jquery:1
Uncaught SyntaxError: Unexpected token < bootstrap:1
Trying to navigate to the api link, just refreshes the page, the help page is not displayed.
Using fiddler to try to hit one of the services in IIS Express works as expected. Using fiddler to try to hit any of the servcies returns the default home page.
Please recall no changes made to code, just the default mvc+webapi solution created.
Checked application_start(), it contains
GlobalConfiguration.Configure(WebApiConfig.Register); as the second line.
Any help would be appreciated.
It basically comes down to how you created the solution. In visual studio 2013 Professional, File->New Project -> Visual C# -> Web -> ASP.NET Web Application Click OK. In the pop up under "Add folders and core refrences for:" MVC is checked and greyed out, you cannot un-select it. Check "Web API" check box, click ok. All will work fine while working in VS. However once published as release. Point IIS at published folder, if needed, navigate to page. Page loads but has errors as described above.
To avoid this, do not check the "Web API" check box when creating the new project. Add Web API to the solution after creating it, not during the creation.
VS version 12.0.31101.0 Update 4
.NET version 4.5.52747

Categories