this post was submitted on 06 Feb 2025
27 points (100.0% liked)

technology

23544 readers
145 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS
 

This is for work and ASP.NET and IIS are the technologies my organization want me to use, so I can't change those.

So, I have an ASP.NET MVC webservice. When I start it up, I get the following message:

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5000/
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: [Path]

Path removed to avoid exposing sensitive info. I can access the site just fine on the server it's hosted on by going to http://localhost:5000/. However, it needs to be accessible from other devices. The machine it's hosted on also has an IIS server with a company website, and ideally, I should be able to access this webservice through a URL on the company site. I'm not sure how to do this, though. I've tried dropping it into the site's wwwroot folder and registering it as an application, but that didn't seem to work (I tried entering all of the obvious URLs from another device but only got 404s, and I can confirm that the site itself is accessible from that device).

you are viewing a single comment's thread
view the rest of the comments
[–] leftAF@hexbear.net 8 points 1 day ago* (last edited 1 day ago) (2 children)

Sorry ASP.NET sucks so bad. The VS solution might already have an applicable Publish Profile if it was cloned from another within the organization. Because it's Microsoft and so old, there's a lot of ways to have an existing site configured that can cause issues.

The compiled app should be able to be dropped onto the web server and registered as an application under a new or existing "Site". Sites have virtual hostnames registered within IIS manager, I think they call them "Bindings". The applicationHost.config XML file for the IIS hosting environment makes it easier to find values than IIS Manager but don't get in the habit of making complicated edits without testing. This might be like dev-product.company.local or dev-product.company.net or whatever and should probably be reachable on whatever network you're on.

Once the app is registered to a Site, within IIS manager you can right click the app and hit Browse and it'll open in Internet Explorer probably. If the app has a different initial URL for actually doing something you might have to navigate to it (eg web browser will open to dev-product.company.net/WebApplication-Portal/ but you have to go to dev-product.company.net/WebApplication-Portal/Dashboard )

Also worth checking the Event logs in Windows for errors, but with 404s you could also have a file system permission problem. Usually it'll actually throw a 403 if the IIS service account couldn't access the folder containing files/webapp though.

Oh and make sure the app is in one of the "app pools" and check the pool it's in is Started.

[–] BeamBrain@hexbear.net 1 points 1 day ago* (last edited 1 day ago)

Alright, so I can confirm the following:

  • The ASP.NET service is registered to an application pool.
  • The pool it's in is started.
  • When I right click it in IIS and choose "Manage Application -> Browse", it opens the URL https://[Site Home]/[App Name]. However, I get the site's "page not found" redirect, so something's still missing.
[–] BeamBrain@hexbear.net 1 points 1 day ago

Will give these suggestions a try, thanks!