How to fix a port number in asp.NET development server

前端 未结 3 1982
野趣味
野趣味 2021-01-23 15:10

Yesterday I was writing a stand-alone .html web-page. Every time I viewed it, the file was run in the local host. Thus a port number was assigned by my OS (Windows 8).

3条回答
  •  醉梦人生
    2021-01-23 15:56

    If you're using VS, you can create a project with just an HTML file (and whatever other non-.NET things you need). From there you can set the port under the project settings. I understand that you're using VS just as the text editor (I do the same thing all of the time), but if you want to set the port, that's how you're going to need to do it because otherwise VS is going to pick a port unless the project file (which is missing) tells it to use a specific port. If you use the "open in browser" feature, it actually launches the web server and uses that to host the HTML file.

    An alternative would be to edit/save in Visual Studio and open the file in your browser for testing. This will work because it's an HTML file and you don't need a webserver to view it.

    my redirects don't work

    The port shouldn't effect your redirects unless you're specifically referencing a protocol and port...but you shouldn't need to do that. Can you post your code or give an explanation as to what's happening here?

提交回复
热议问题