How to enable external request in IIS Express?
Asked Answered
R

27

548

How can I enable remote requests in IIS Express? Scott Guthrie wrote that is possible but he didn't say how.

Rotherham answered 22/7, 2010 at 21:23 Comment(6)
There's a free VS extension for this that we wrote visualstudiogallery.msdn.microsoft.com/…Madalinemadalyn
@JimW Jim, are you the creator of the plugin? Please could you explain how this miracle of software engineering works?Impurity
@IanWarburton thanks for calling it a miracle! It's a reverse proxy server.Madalinemadalyn
@JimW I tried your plugin and do all like you said in tutorial. But I stil cannot acess my localhostWheelbase
@JimW how can a single machine have many IPs different from physical IP, as is case in Coveyor dropdown Remote URL IP list ?Loeffler
@Loeffler I answered your full question here #63281156Madalinemadalyn
H
420

There's a blog post up on the IIS team site now explaining how to enable remote connections on IIS Express. Here is the pertinent part of that post summarized:

On Vista and Win7, run the following command from an administrative prompt:

netsh http add urlacl url=http://vaidesg:8080/ user=everyone

For XP, first install Windows XP Service Pack 2 Support Tools. Then run the following command from an administrative prompt:

httpcfg set urlacl /u http://vaidesg1:8080/ /a D:(A;;GX;;;WD)

Houlihan answered 29/7, 2010 at 15:55 Comment(18)
In case of a 503 Error, see this: #5443051Halftimbered
Is there a netsh command to allow connections on any hostname?Cassiecassil
this will work: https://mcmap.net/q/73476/-how-to-enable-external-request-in-iis-express for some reason this reply did not work for me.Protein
and with windoes 8.1 ?Mesocarp
+1 for providing XP instructions as well. Talk about going above and beyond with your answer!Ape
Just for the record, in case you have Windows machine in a non English language, the parameter of user={PARAM_USER} will be in your own language.Powell
No need to change applicationhost.config as explained in the 503 fix link from @deerchao: just restart your IIS Express Service.Hess
A way to undo this afterwards would be nice too, if not asking for too much. I guess there is a reason that IIS Express is not pre-configured to do that (the amount security holes it has in it I assume).Jackknife
Link: "enable remote connections on IIS Express" has gone deadHerzel
Create SDDL failed, Error: 1332Bensky
Using wildcards in the url-parameter (e.g. url=http://*:8080/) will make connections work for both hostname and the computer's IP address.Wildlife
No matter how hard I tried, I could not get the above to work using localhost instead of the guest machine name (vaidesg in the above example). Finally found that mapping the guest machine name to 127.0.0.1 in /etc/hosts on the host machine allowed a request to the guest machine to work.Veritable
In case the command fails (probably error 1789) take into account that the command expects for the user in your PC language. So if your PC is in Portuguese for example, use user=todos instead of user=everyone.Digression
Note to self: When using http://*:8080/ with netsh, applicationhost.config should use bindingInformation=":8080:" When using hostname:8080 with netsh, applicationhost.config should use bindingInformation="*:8080:hostname"Zayas
The forward slash at the end was necessary. vaidesg:8080 did not work. But vaidesg:8080 worked.Teacher
Plus I also had to set firewall rule and application.config as mentioned in below comment: https://mcmap.net/q/73476/-how-to-enable-external-request-in-iis-expressTeacher
After running the above netsh command with my URL, my Visual Studio 2019 started throwing the following error when I try to start debugging: "Unable to connect to web server 'IIS Express'". After using "netsh http remote urlacl XXX" I got my IIS Express working again.Sememe
In case who may need to reverse the operation netsh http delete urlacl url=http://*:8080/ Mishnah
C
388

There are three changes you might need to make.

  1. Tell IIS Express itself to bind to all ip addresses and hostnames. In your .config file. Typically:
    • VS 2015: $(solutionDir)\.vs\config\applicationhost.config
    • < VS 2015: %userprofile%\My Documents\IISExpress\config\applicationhost.config

Find your site's binding element, and add

    <binding protocol="http" bindingInformation="*:8080:*" />
  1. Setup the bit of Windows called 'http.sys'. As an administrator, run the command:
    netsh http add urlacl url=http://*:8080/ user=everyone

Where everyone is a windows group. Use double quotes for groups with spaces like "Tout le monde".

  1. Allow IIS Express through Windows firewall.

    Start / Windows Firewall with Advanced Security / Inbound Rules / New Rule...

    Program %ProgramFiles%\IIS Express\iisexpress.exe
    OR Port 8080 TCP

Now when you start iisexpress.exe you should see a message such as

Successfully registered URL "http://*:8080/" for site "hello world" application "/"

Cassiecassil answered 4/4, 2013 at 11:19 Comment(18)
Great summary list, thanks! #1 and #3 was enough for me on Win7.Persona
N.B. If you are running a localized version of Windows the parameter users=everyone for netsh (second step) may cause error 1789. Solution is to translate everyone to the corresponding group name in your language.Catalonia
How do you get a Visual Studio project to accept that binding? In the project properties, where you specify Project Url, if I enter an asterisk for the hostname it gives an error. If I enter anything else, it tries to make a new virtual directory. It doesn't link to the entry in application.config.Kosciusko
To make it work for Visual Studio I had to run IIS Express manually from the admin prompt %programfiles%iisexpress /site:the_site_name_from_the_config_file (and attached to the process from VS)Chesser
To make it work in Visual Studio, you must use your computer's hostname in step 1 bindingInformation="*:8080:hostname" and in step 2 url=http://hostname:8080/, and in your Visual Studio web project properties on the Web tab set Project Url to http://hostname:8080/. Delete the * urlacl if you already created one; it won't work if you have both. Finally, the URL that you go to in your web browser must reference the hostname, not localhost.Uziel
I had to have a localhost line in the bindings element as well, otherwise visual studio 2013 tried to create a duplicate site entry. e.g.: <binding protocol="http" bindingInformation="*:8080:localhost" />Chinchin
c:\Windows\System32\inetsrv\config\Ionization
@Chinchin - I think I am seeing the same problem as you were. Every few times I launch my Visual Studio web project I get a duplicate site entry in applicationhost.config, eg <site name="WebApplication1(4)", <site name="WebApplication1(5)", etc... and each time the bindingInformation reverts back to *:port:localhost. What are you suggesting be done?Bicorn
Thanks for the remark for VS 2015! For me the step 2 broke the functionality (only 1 and 3 needed). How to delete urlacl is hereKeary
I also needed to run Visual Studio as administrator, but this answer was the most thorough.Astor
Make sure to add it as a second binding instead of modifying the existing one or VS will just re-add a new site appended with a (1)Payment
For me <binding protocol="http" bindingInformation=":8080:" /> solves the issue in VS 2015Brickwork
As @Astor said - please could you mention that you might need to run VS as Administrator - if you get Service Unavailable - HTTP Error 503: The service is unavailable.Mar
All the above 3 steps were required in my case. Thanks a lot!Teacher
I get "Invalid URI: The hostname could not be parsed!".Endometriosis
If you get an error saying that IIS Express failed to register the URL http://localhost:55555 when you start the project in Visual Studio, try adding another urlacl entry specifically for localhost: netsh http add urlacl url=http://localhost:55555/ user=everyone. For whatever reason the wildcard didn't work for me when I started debugging in VS 2015 and adding the second urlacl fixed this.Kasandrakasevich
Remember to add 8080 port to entry rules on Windows firewall.Petrography
Step 1 worked fine. Step 2 broke the URL, always returning status 503. when I deleted the urlacl it started working again, even from an external request.Unrivaled
D
177

Nothing worked for me until I found iisexpress-proxy.

Open command prompt as administrator, then run

npm install -g iisexpress-proxy

then

iisexpress-proxy 51123 to 81

assuming your Visual Studio project opens on localhost:51123 and you want to access on external IP address x.x.x.x:81

Edit: I am currently using ngrok

Drongo answered 10/11, 2015 at 5:20 Comment(11)
Easiest solution I could find. Should probably rename the package to something like web-proxy since you can use it for more than forwarding iisexpress :)Finsen
Couldn't get it to work. Here are the commands I entered. Any ideas? C:\Program Files\iisexproxy>npm install -g iisexpress-proxy C:\Users\xavier\AppData\Roaming\npm\iisexpress-proxy -> C:\Users\xavier\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js [email protected] C:\Users\xavier\AppData\Roaming\npm\node_modules\iisexpress-proxy └── [email protected] ([email protected], [email protected]) C:\Program Files\iisexproxy>iisexpress-proxy 54954 to 3000 'iisexpress-proxy' is not recognized as an internal or external command, operable program or batch file.Themselves
@xgp - Hi, I'm the author of iisexpress-proxy :-) Have you managed to make it work for you in the end? You have to close & reopen the command prompt, or in rare cases event restart the os. Drop me a line in the project page (github.com/icflorescu/iisexpress-proxy) if you have further questions and I'll try to help if I have time.Wohlert
Thank you all for using it and for your kind words :-). @MarioTacke - yeah, I know, but more people are able to find it by just google-ing if it's called iisexpress-proxy :-)Wohlert
Btw, this does not work with Windows authentication.Bathrobe
For me worked only on ethernet IP adress (not other 2), but it's still great!Wamble
It works, but if you have Response.Redirect("~/somePage.aspx") in your code, you are sent to "localhost:51123/somePage.aspx" instead of "x.x.x.x:81/somePage.aspx"Squad
you made me lose only 3 hours. Thank you for that sir! Otherwise, who knows when I would have made it work?!Amok
iisexpress-proxy, thanks but NO thanks. Here's the best solution hands down: marketplace.visualstudio.com/…Stickleback
@Stickleback except that sometimes Conveyor does not start and in some cases it freezes VS very hard. Dropped it.Silvas
@Silvas while iisexpress-proxy does not work at all.Stickleback
W
148

I remember running into the same problems while trying this workflow a few months ago.

Which is why I wrote a simple proxy utility specifically for this kind of scenario: https://github.com/icflorescu/iisexpress-proxy.

Using the IIS Express Proxy, it all becomes quite simple – no need to “netsh http add urlacl url=vaidesg:8080/ user=everyone” or to mess up with your “applicationhost.config”.

Just issue this in command prompt:

iisexpress-proxy 8080 to 3000

…and then you can point your remote devices to http://vaidesg:3000.

Most of the times simpler IS better.

Wohlert answered 30/4, 2015 at 15:23 Comment(8)
And I might add that Node.js solutions like this are the only ones that work reliably over Azure, since Azure builds auto-generate the applicationhost.config file and erase your binding changes.Snort
I've started using IIS Express Proxy on my Mac along with ngrok after ngrok didn't work as expected (because I hadn't done the IIS Express configuration manipulation needed). Very handy! Thank you.Uniplanar
This works fine for me for http but not https. Is there anything else you need to do for https?Alec
This is by far the easiest solution. I prefer not to mess with the applicationhost.config if I don't have to.Tusche
Great thing i dont know why i m facing this issue or my understading prob, if i access it using intranet then it works fine but if try to use it outside of Local network it doesnt work .Primateship
@TheHansinator To override/overwrite/modify Azure App Service's applicationHost.config use XDT, it's officially supported: #31428135Contrapositive
IIS Express Proxy 1.5.3 Proxying localhost:44321 to network interfaces: Ethernet: 192.168.8.2:80 VirtualBox Host-Only Network: 192.168.56.1:80 Listening... [press Control-C to exit] Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:211:20) { errno: -4077, code: 'ECONNRESET', syscall: 'read' } Listening... [press Control-C to exit]Famous
iisexpress-proxy, thanks but NO thanks. Here's the best solution hands down: marketplace.visualstudio.com/…Stickleback
S
54

If you're working with Visual Studio then follow these steps to access the IIS-Express over IP-Adress:

  1. Get your host IP-Adress: ipconfig in Windows Command Line

  2. GoTo

    $(SolutionDir)\.vs\config\applicationHost.config
    
  3. Find

    <site name="WebApplication3" id="2">
       <application path="/" applicationPool="Clr4IntegratedAppPool">
          <virtualDirectory path="/" physicalPath="C:\Users\user.name\Source\Repos\protoype-one\WebApplication3" />
       </application>
       <bindings>
         <binding protocol="http" bindingInformation="*:62549:localhost" />
       </bindings>
    </site>
    
  4. Add: <binding protocol="http" bindingInformation="*:62549:192.168.178.108"/>
    with your IP-Adress

  5. Run your Visual Studio with Administrator rights and everything should work

  6. See post from Andrii how to configure Firewall: here

Shilohshim answered 31/3, 2017 at 7:33 Comment(3)
This didn't work. That's why the downvoteTry
@Try maybe you forgot something - for the other's it seems to workShilohshim
Work for me, remember to run VS as administrator, and use "Windows Firewall with Advanced Security" and add the Inbound Rule for the ports you have bound your app on IIS Express to. Credit to AndriiAlatea
D
37

As a sidenote to this:

netsh http add urlacl url=http://vaidesg:8080/ user=everyone

This will only work on English versions of Windows. If you are using a localized version you have to replace "everyone" with something else, for example:

  • "Iedereen" when using a Dutch version
  • "Jeder" when using a German version
  • "Mindenki" when using a Hungarian version

Otherwise you will get an error (Create SDDL failed, Error: 1332)

Dithyrambic answered 12/5, 2013 at 14:1 Comment(0)
K
31

A good resource is Working with SSL at Development Time is easier with IISExpress by Scott Hanselman.

What you're after is the section Getting IIS Express to serve externally over Port 80

Kellby answered 25/5, 2011 at 4:12 Comment(1)
This blog post recommends isolating port 80 to "IISExpressWeb.exe". The current version of IIS Express lacks an exe of this name - there's only IISExpress.exe and IISExpressTray.exe. Isolating connections to either prevents a connection from the outside; eliminating the process restriction allows connections in. What's the proper .exe to target?Gnarled
P
29

I solved it with the installation of "Conveyor by Keyoti" in Visual Studio Professional 2015. Conveyor generate a REMOTE address (your IP) with a port (45455) that enable external request. Example:

enter image description here

Conveyor allows you test web applications from from external tablets and phones on your network or from Android emulators (without http://10.0.2.2:<hostport>)

The steps are in the following link :

https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti

Pasturage answered 19/6, 2017 at 20:5 Comment(6)
@kilianeller please follow the link in the answer and ask a question there, we can help you out.Madalinemadalyn
Workst!!, i prove all the other solution(change applicationhost.config,netsh, IPv6 adress..) and nothing, but installing this finally Works, the only small issue was that misdirected the IP address, but not serious problem.Rightist
Really easy to install. Just make sure you add the certificate on your remote browser as instructed on the extension's page.Katharynkathe
I cannot believe it, it works !!! SO SIMPLE, SO ELEGANT !!! I spent last 5 hours only to look for empty solutions and finally I fount this !Rizzo
Works like charm !, This should be the best answerMikaelamikal
The best answer! Why people choose overly complicated solutions over this one, escapes me.Stickleback
T
17

Combining answers in this thread, this is how I fixed it(Visual Studio 2019):

  1. Start Visual Studio as an Administrator and Run your Web Service as you normally do.

  2. Find IIS Express icon on the taskbar, right click on it then click "Show All Applications".

  3. Select your Web Service and note the config path displayed below. Click on the config file to open it for editing.

  4. Find your web service(example search for your port) in this config file then find a line like this: *:yourport:localhost

  5. Add a new line after that like this:

    :yourport:*

In this case no need to create bindings with specific ip address which could change in the future.

I hope this helps someone out there.

Tamarisk answered 14/9, 2020 at 13:52 Comment(1)
this solved my quest for android avd consumes rest api on localhost:portWinged
D
13

This is what I did for Windows 10 with Visual Studio 2015 to enable remote access, both with http and https:

First step is to bind your application to your internal IP address. Run cmd -> ipconfig to get the address. Open the file /{project folder}/.vs/config/applicationhost.config and scroll down until you find something like this:

<site name="Project.Web" id="2">
    <application path="/">
        <virtualDirectory path="/" physicalPath="C:\Project\Project.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:12345:localhost" />
    </bindings>
</site>

Add two new bindings under bindings. You can use HTTPS as well if you like:

<binding protocol="http" bindingInformation="*:12345:192.168.1.15" />
<binding protocol="https" bindingInformation="*:44300:192.168.1.15" />

Add the following rule to your firewall, open a new cmd prompt as admin and run the following commands:

netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=12345 profile=private remoteip=localsubnet action=allow

netsh advfirewall firewall add rule name="IISExpressWebHttps" dir=in protocol=tcp localport=44300 profile=private remoteip=localsubnet action=allow

Now start Visual Studio as Administrator. Right click the web projects project file and select Properties. Go to the Web tab, and click Create Virtual Directory. If Visual Studio is not run as Administrator this will probably fail. Now everything should work.

enter image description here

Derwood answered 7/12, 2016 at 11:56 Comment(3)
Worked for me! :) There's also a nice post here: blog.kloud.com.au/2017/02/27/…Gossett
I tried everything else including ngrok to no avail. This worked on first try.Dormant
I found you can also do "*:12345:*" Save a step in looking up your IP address or dealing with the IP address changing via DHCPLannie
H
12

What helped me, was right clicking the 'IISExpress' icon, 'Show All applications'. Then selecting the website and I saw which aplicationhost.config it uses, and the the correction went perfectly.

IISExpress configuration

Hanhana answered 18/11, 2016 at 8:31 Comment(2)
This answer pointed me to another solution, editing applicationhost.config to accept :55665: instead of *:55665:localhostDavina
Thanks @Davina -- your comment, coupled with the netsh command mentioned in a few other replies, made it work for me.Nawab
K
10

The simplest and the coolest way I found was to use (it takes 2 minutes to setup):

https://ngrok.com/

It will work with anything running on localhost. Just signup, run little excutable and whatever you run on localhost gets public URL you can access from anywhere.

This is good for showing stuff to your remote team mates, no fiddling with IIS setup or firewalls. Want to stop access just terminate executable.

ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ngrok http -host-header=localhost 89230

assuming that 89230 is your IIS Express port

You can also run multiple ports even on free plan

Kalagher answered 1/11, 2018 at 14:17 Comment(2)
Who would think I will have to read through such many responses until I get a solution...Sleety
Man, i almost discarded ngrok as I always got a Bas Request 400 Invalid hostname. Using -host-header solved it. Thanks a bunch!Caroylncarp
L
9

If you have tried Colonel Panic's answer but doesn't work in Visual Studio, try this:

Append another <binding /> in your IIS Express config

<bindings>
    <binding protocol="http" bindingInformation="*:8080:localhost" />
    <binding protocol="http" bindingInformation="*:8080:hostname" />
</bindings>

Finally, you have to run Visual Studio as Admin

Loats answered 1/7, 2015 at 6:52 Comment(6)
Unfortunately, that doesnt seem to work for me.. I still get connection refused when i try to access my local ip on port 8080Imphal
@ThomasTeilmann, in Visual Studio, I had to open the web application's properties, and under the Web tab, change "Project Url" to use the alternate host name instead of localhost.Uncompromising
@ThomasTeilmann, Oh, and I think you need to browse to it by host name rather than IP.Uncompromising
I tried both of that too, actually, and it didnt work for the cloud instance :/ Thanks thoughImphal
This was the answer for me (i.e. run VS as admin) - thanks @Bruce. In addition I also had to manually fixup my firewall settings. In my case (i.e. testing that my iphone can browse my dev machine) opening up port 8080 on the firewall didn't work (huh?) but opening access by ip (i.e. Scope > Local IPs = 10.0.0.0/24 = my home network) did the trick.Casuist
Can we differentiate between VS versions? I just tried this and it worked for me - in addition to firewall config. I am using Visual Studio 2013Kasandrakasevich
B
5

The accepted answer to this question is a guide for getting IIS Express to work with webmatrix. I found this guide more useful when trying to get it to work with VS 2010.

I just followed steps 3 & 4 (running IIS Express as administrator) and had to temporarily disable my firewall to get it working.

Brashy answered 16/5, 2011 at 0:19 Comment(2)
The instructions you link to lose the ability to debug from Visual Studio, which at least in my view makes it pointless - using IIS or any other remote server would be as good or better (because you could setup remote debugging on IIS at least). If IIS Express didn't require admin privileges to run without localhost this would just work. Very annoying.Gnarled
This is exactly what I was looking for - thanks! I'm using IIS Express with Visual Studio 2010 and was going to test an ASP.NET MVC3 application on my LAN, and this was what I needed for that to work :)Yod
M
5

You may try setting up port forwarding instead of trying to modify your IIS Express config, adding new HTTP.sys rules or running Visual Studio as an Admin.

Basically you need to forward the IP:PORT your website runs at to some other free port on your machine but on the external network adapter, not localhost.

The thing is that IIS Express (at least on Windows 10) binds to [::1]:port meaning it listens on IPv6 port. You need to take this into account.

Here is how I made this work - http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html

Hope it helps.

Milan answered 7/3, 2017 at 9:42 Comment(2)
I am running Windows 10 and binding localhost to IPv6 was the key. Thanks!Hemimorphic
The computer I was trying to configure had another local address. It was named "local-dev". I had just to bind add v4tov6 listenport=3000 connectaddress=local-dev connectport=60000 to make it work. Great post, thank you!Harrelson
T
3

I have some problems using IIS Express in Win 8.1 and external request.

I follow this steps to debug the external request:

  1. Install IIS
  2. Configure Visual Studio to use local IIS (Page properties in your Web Project)
  3. Create a exclusive AppPool in IIS to work with my application
  4. In my Project I'm using Oracle Client and must be 32bits (64 bits don't work with Visual Studio) then I need allow 32 bit in Application Pool
  5. Configure the Windows firewall to allow request in port 80 (inbound rules)

It's working!

Thrown answered 3/8, 2014 at 19:51 Comment(0)
A
3

I had a local IIS enabled so i just created a rewrite rule to my debugging port... I think this is better and cooler than other method because it is easier to remove once am done developing... Here is how the rewrite looks..

<rewrite>
    <rules>
        <rule name="ReverseProxyInboundRule1" stopProcessing="true">
            <match url="^dev/(.*)" />
            <action type="Rewrite" url="http://localhost:47039/{R:1}" />
        </rule>
    </rules>
</rewrite>

VS also allows you to develop using your local IIS directly (which then allows remote connections) but in turn you must always run it as an administrator... I dont like that.

Alcorn answered 20/9, 2016 at 16:11 Comment(2)
This is my favorite solution too, thanks :) I just had to enable Reverse Proxy for my IIS first, then add this rule to my web.config.Quinnquinol
kindly explain what does this rule do? and how do I access the localhost portProthesis
C
3

If you run Visual Studio from Admin you can add just

<binding protocol="http" bindingInformation="*:8080:*" />

or

<binding protocol="https" bindingInformation="*:8443:*" />

into

%userprofile%\My Documents\IISExpress\config\applicationhost.config
Chew answered 26/12, 2016 at 23:34 Comment(1)
I applied this configuration to $(SolutionDir).vs\config\applicationHost.config and also, I had to open the port (8443) of the application in Windows firewall.Brambly
C
3

Another way to access external requests is to use IIS instead of IIS Express. In my visual studio, I can just switch easily.

enter image description here

Civil answered 3/3, 2020 at 9:57 Comment(1)
I am using VS2019.Civil
T
1

I solved this problem by using reverse proxy approach.

I installed wamp server and used simple reverse proxy feature of apache web server.

I added a new port to listen to Apache web server (8081). Then I added proxy configuration as virtualhost for that port.

<VirtualHost *:8081>
ProxyPass / http://localhost:46935/
ProxyPassReverse / http://localhost:46935/
</VirtualHost>
Tandie answered 9/11, 2016 at 8:24 Comment(0)
R
1

I did all of these steps and nothing helped me. And what I need, it's just to run my app via IIS Express...

enter image description here

Hope it helps.

Rebec answered 18/2, 2019 at 10:58 Comment(0)
D
1

For me using this, relatively simple, and straight forward:

Download the Visual Studio Extension by searching for 'Conveyor' in the Extensions dialog. Then just install.

form: https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti

Danelle answered 20/8, 2020 at 9:5 Comment(0)
O
0

I was unable to serve iis requests to other users in my local network, all I had to do (in addition to the above) was restart my BT Hub router.

Orthotropic answered 1/4, 2015 at 10:1 Comment(0)
J
0

This is insanely awesome and even covers HTTPS with pretty domain names:

http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

The really awesome parts I couldn't find anywhere else on SO in case the above link ever goes away:

> C:\Program Files (x86)\IIS Express>IisExpressAdminCmd.exe Usage:
> iisexpressadmincmd.exe <command> <parameters> Supported commands:
>       setupFriendlyHostnameUrl -url:<url>
>       deleteFriendlyHostnameUrl -url:<url>
>       setupUrl -url:<url>
>       deleteUrl -url:<url>
>       setupSslUrl -url:<url> -CertHash:<value>
>       setupSslUrl -url:<url> -UseSelfSigned
>       deleteSslUrl -url:<url>
> 
> Examples: 1) Configure "http.sys" and "hosts" file for friendly
> hostname "contoso": iisexpressadmincmd setupFriendlyHostnameUrl
> -url:http://contoso:80/ 2) Remove "http.sys" configuration and "hosts" file entry for the friendly  hostname "contoso": iisexpressadmincmd
> deleteFriendlyHostnameUrl -url:http://contoso:80/

The above utility will register the SSL certificate for you! If you use the -UseSelfSigned option, it's super easy.

If you want to do things the hard way, the non-obvious part is you need to tell HTTP.SYS what certificate to use, like this:

netsh http add sslcert ipport=0.0.0.0:443 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=YOURCERTHASHHERE

Certhash is the "Thumbprint" you can get from the certificate properties in MMC.

Jeremiah answered 3/11, 2015 at 5:18 Comment(0)
U
0

I did the following and was able to connect:

1) changed IIS express config binding from local host to '*'

binding protocol="http" bindingInformation="*:8888:*"

2) Defined inbound rule on firewall to allow the particular port for the protocol type: tcp

3) Add the following command to add network configuration for your port: netsh http add urlacl url=http://*:8888/ user=everyone

Unable answered 21/10, 2016 at 20:2 Comment(1)
Since you're coming to this question 6 years after it was asked, and there are already 12 other answers, it would be best if you edited your answer to explain how your answer works better than the other 12 (or at least how it is different).Rheumatic
A
0

What helped me in my dotnet core 6 project to allow remote access to my IIS server is to set up the project's "applicationUrl" parameter in [solution directory]/Properties/launchSettings.json changing the value from "http://localhost:5000" to "http://0.0.0.0:5000"

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:20845",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "MyLittleProject": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "applicationUrl": "http://0.0.0.0:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

But it's also important to set up a firewall properly to allow access to server's TCP port: in my case an inbound rule for TCP port 5000 to allow connections was added.

Artema answered 11/1, 2023 at 19:1 Comment(0)
T
-1

[project properties dialog]

For development using VisualStudio 2017 and a NetCore API-project:

1) In Cmd-Box: ipconfig /all to determine IP-address

2a) Enter the retrieved IP-address in Project properties-> Debug Tab

2b) Select a Port and attach that to the IP-address from step 2a.

3) Add an allow rule in the firewall to allow incoming TCP-traffic on the selected Port (my firewall triggered with a dialog: "Block or add rule to firewall"). Add will in that case do the trick.

Disadvantage of the solution above:

1) If you use a dynamic IP-address you need to redo the steps above in case another IP-address has been assigned.

2) You server has now an open Port which you might forget, but this open port remains an invitation for unwanted guests.

Terchie answered 20/6, 2018 at 12:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.