543

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

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
TedTel
  • 5,445
  • 3
  • 16
  • 6
  • 35
    There's a free VS extension for this that we wrote https://visualstudiogallery.msdn.microsoft.com/a429dbb7-a982-4541-b401-934375c02c0f – Jim W Nov 08 '16 at 05:03
  • @JimW Jim, are you the creator of the plugin? Please could you explain how this miracle of software engineering works? – Ian Warburton Jan 11 '17 at 15:37
  • @IanWarburton thanks for calling it a miracle! It's a reverse proxy server. – Jim W Jan 11 '17 at 16:57
  • @JimW I tried your plugin and do all like you said in tutorial. But I stil cannot acess my localhost – mark_spencer Sep 19 '17 at 15:15
  • @mark_spencer Please email support at keyoti.com and we'll help you there. – Jim W Sep 19 '17 at 17:23
  • I wrote email to support@JimW – mark_spencer Sep 19 '17 at 17:27
  • @JimW how can a single machine have many IPs different from physical IP, as is case in Coveyor dropdown Remote URL IP list ? – SimpleGuy Aug 06 '20 at 09:11
  • @SimpleGuy I answered your full question here https://stackoverflow.com/questions/63280656/why-does-conveyor-by-keyoti-have-multiple-remote-url-ip-address/63287153#63287153 – Jim W Aug 06 '20 at 15:42
  • 2
    @JimWsaysreinstateMonica Absolutely beautiful, wonderful, fantastic. Please, post it as an answer and let us up vote it! I don't understand why people keep on suggesting iisexpress-proxy, which really sucks and doesn't work anyway. – dpant Nov 13 '22 at 20:26

27 Answers27

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)

Community
  • 1
  • 1
Damian Edwards
  • 7,289
  • 1
  • 25
  • 19
  • 127
    In case of a 503 Error, see this: http://stackoverflow.com/questions/5442551/iisexpress-returns-a-503-error-from-remote-machines – deerchao Oct 12 '12 at 03:31
  • 7
    Is there a `netsh` command to allow connections on *any* hostname? – Colonel Panic Apr 03 '13 at 13:24
  • this will work: http://stackoverflow.com/a/15809698/566608 for some reason this reply did not work for me. – Felice Pollano Aug 06 '13 at 13:43
  • and with windoes 8.1 ? – Zapnologica Mar 05 '14 at 17:08
  • +1 for providing XP instructions as well. Talk about going above and beyond with your answer! – Grinn May 13 '14 at 20:39
  • 37
    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. – GoRoS Jun 04 '14 at 06:56
  • No need to change applicationhost.config as explained in the 503 fix link from @deerchao: just restart your IIS Express Service. – enguerran Oct 02 '14 at 13:55
  • 1
    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). – user2173353 Jul 28 '15 at 09:58
  • 1
    Link: "enable remote connections on IIS Express" has gone dead – Talon Aug 07 '15 at 14:11
  • Create SDDL failed, Error: 1332 – Marcus Sep 07 '15 at 13:38
  • 10
    Using wildcards in the url-parameter (e.g. url=http://*:8080/) will make connections work for both hostname and the computer's IP address. – Anders Nov 30 '15 at 11:04
  • 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. – Matt Jan 10 '16 at 19:59
  • 3
    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`. – Vitor Canova Jan 13 '16 at 17:37
  • 1
    Note to self: When using http://*:8080/ with netsh, applicationhost.config should use bindingInformation="*:8080:*" When using http://hostname:8080/ with netsh, applicationhost.config should use bindingInformation="*:8080:hostname" – StarQuake Sep 07 '17 at 12:01
  • The forward slash at the end was necessary. http://vaidesg:8080 did not work. But http://vaidesg:8080/ worked. – Gautam Jain Sep 23 '17 at 07:07
  • Plus I also had to set firewall rule and application.config as mentioned in below comment: https://stackoverflow.com/a/15809698/15065 – Gautam Jain Sep 23 '17 at 07:25
  • 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. – tholesen Jan 09 '20 at 13:39
  • In case who may need to reverse the operation `netsh http delete urlacl url=http://*:8080/ ` – Zhang Aug 02 '23 at 01:55
385

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 "/"

Jerther
  • 5,558
  • 8
  • 40
  • 59
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
  • 2
    Great summary list, thanks! #1 and #3 was enough for me on Win7. – Tormod Hystad Apr 15 '13 at 08:40
  • 25
    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. – mflodin Aug 21 '13 at 13:47
  • 6
    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. – Trevor Elliott Aug 26 '13 at 23:45
  • 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) – joeriks Nov 06 '13 at 14:06
  • 20
    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. – Joe Daley Feb 05 '14 at 00:35
  • 5
    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.: `` – kristianp Jul 28 '14 at 03:08
  • c:\Windows\System32\inetsrv\config\ – Krekkon Nov 24 '14 at 15:33
  • @kristianp - 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 – Matthew Jun 12 '15 at 19:27
  • 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 [here](https://msdn.microsoft.com/en-us/library/windows/desktop/cc307231(v=vs.85).aspx) – Jan Zahradník Aug 13 '15 at 09:52
  • 4
    I also needed to run Visual Studio as administrator, but this answer was the most thorough. – dlsso Oct 07 '15 at 18:21
  • 2
    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)` – Hugh Jeffner Jan 22 '16 at 17:44
  • 1
    For me solves the issue in VS 2015 – Sergey Malyutin Feb 22 '16 at 13:39
  • As @dlsso 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.` – Ian Grainger Sep 15 '17 at 09:11
  • All the above 3 steps were required in my case. Thanks a lot! – Gautam Jain Sep 23 '17 at 07:24
  • I get "Invalid URI: The hostname could not be parsed!". – Tomáš Zato Oct 18 '17 at 23:40
  • 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. – Nick Nov 07 '17 at 19:00
  • Remember to add 8080 port to entry rules on Windows firewall. – Yun CHEN Jul 10 '18 at 13:50
  • 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. – Cleber Machado Oct 19 '22 at 12:58
173

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

Toolkit
  • 10,779
  • 8
  • 59
  • 68
  • 4
    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 :) – Mario Tacke Jan 22 '16 at 16:48
  • 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 iisexpress-proxy@1.1.3 C:\Users\xavier\AppData\Roaming\npm\node_modules\iisexpress-proxy └── http-proxy@1.13.1 (eventemitter3@1.1.1, requires-port@1.0.0) 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. – gilpach Feb 17 '16 at 07:25
  • 11
    @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 (https://github.com/icflorescu/iisexpress-proxy) if you have further questions and I'll try to help if I have time. – Ionut-Cristian Florescu Mar 01 '16 at 20:38
  • 3
    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 :-) – Ionut-Cristian Florescu Mar 01 '16 at 20:40
  • 1
    Btw, this does not work with Windows authentication. – Tom May 11 '16 at 15:17
  • For me worked only on ethernet IP adress (not other 2), but it's still great! – Tinmar Apr 25 '17 at 14:39
  • 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" – Murilo Jun 07 '18 at 20:17
  • you made me lose only 3 hours. Thank you for that sir! Otherwise, who knows when I would have made it work?! – RazvanR Jan 22 '20 at 11:55
  • iisexpress-proxy, thanks but NO thanks. Here's the best solution hands down: https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti – dpant Nov 13 '22 at 20:28
  • @dpant except that sometimes Conveyor does not start and in some cases it freezes VS very hard. Dropped it. – Dima Nov 14 '22 at 21:46
  • @Dima while iisexpress-proxy does not work at all. – dpant Nov 15 '22 at 18:55
146

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.

Ionut-Cristian Florescu
  • 1,798
  • 1
  • 10
  • 11
  • 1
    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. – TheHans255 Dec 10 '15 at 22:39
  • 1
    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. – codingoutloud May 08 '16 at 12:36
  • This works fine for me for http but not https. Is there anything else you need to do for https? – Kai G May 15 '16 at 00:36
  • 1
    This is by far the easiest solution. I prefer not to mess with the applicationhost.config if I don't have to. – skalpin Jun 10 '16 at 14:44
  • 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 . – Salman Jun 08 '17 at 11:41
  • @TheHansinator To override/overwrite/modify Azure App Service's `applicationHost.config` use XDT, it's officially supported: https://stackoverflow.com/questions/31427635/applicationhost-xdt-in-azure-web-apps – Dai Mar 23 '20 at 03:55
  • IIS Express Proxy 1.5.3 Proxying http://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] – EKanadily Apr 22 '21 at 09:36
  • iisexpress-proxy, thanks but NO thanks. Here's the best solution hands down: https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti – dpant Nov 13 '22 at 20:29
49

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

Daniel Eisenreich
  • 1,353
  • 3
  • 16
  • 32
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)

John Weisz
  • 30,137
  • 13
  • 89
  • 132
brz
  • 1,846
  • 21
  • 21
32

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

  • 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? – Chris Moschini Jun 23 '12 at 18:14
28

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

Ronny Morán
  • 557
  • 6
  • 10
  • @kilianeller please follow the link in the answer and ask a question there, we can help you out. – Jim W Oct 02 '17 at 18:27
  • 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. – Ion Apr 19 '18 at 11:11
  • Really easy to install. Just make sure you add the certificate on your remote browser as instructed on the extension's page. – Andres Jul 20 '18 at 18:30
  • 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 ! – Ziggy192 Jul 23 '18 at 01:13
  • 1
    Works like charm !, This should be the best answer – Adel Mourad Jul 21 '21 at 14:47
  • The best answer! Why people choose overly complicated solutions over this one, escapes me. – dpant Dec 24 '22 at 16:58
15

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.

MelOS
  • 595
  • 5
  • 10
12

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

Ogglas
  • 62,132
  • 37
  • 328
  • 418
11

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

Emmanuel
  • 7,574
  • 3
  • 24
  • 22
  • 2
    This answer pointed me to another solution, editing applicationhost.config to accept *:55665:* instead of *:55665:localhost – Deko Apr 20 '17 at 14:14
  • Thanks @Deko -- your comment, coupled with the netsh command mentioned in a few other replies, made it work for me. – Marcel Popescu Dec 02 '19 at 16:47
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

Toolkit
  • 10,779
  • 8
  • 59
  • 68
Artur Kedzior
  • 3,994
  • 1
  • 36
  • 58
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

Community
  • 1
  • 1
Bruce
  • 2,146
  • 2
  • 26
  • 22
  • Unfortunately, that doesnt seem to work for me.. I still get connection refused when i try to access my local ip on port 8080 – Teilmann Sep 07 '15 at 07:54
  • @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. – Sam Sep 09 '15 at 01:51
  • @ThomasTeilmann, Oh, and I think you need to browse to it by host name rather than IP. – Sam Sep 09 '15 at 02:16
  • I tried both of that too, actually, and it didnt work for the cloud instance :/ Thanks though – Teilmann Sep 09 '15 at 06:56
  • 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. – Ilan Jul 10 '16 at 18:44
  • 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 2013 – Nick Oct 25 '16 at 00:19
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.

srmrco
  • 116
  • 5
  • 6
  • I am running Windows 10 and binding localhost to IPv6 was the key. Thanks! – TomaszGuzialek Mar 10 '17 at 22:00
  • 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! – Anika Jul 27 '17 at 20:49
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.

Chad
  • 2,378
  • 2
  • 26
  • 27
  • 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. – Chris Moschini May 22 '11 at 15:11
  • 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 :) – Lasse Christiansen Feb 22 '12 at 19:31
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!

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.

konzo
  • 1,973
  • 22
  • 32
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
Andrii
  • 1,081
  • 1
  • 11
  • 24
  • 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. – Tonatio Jan 26 '18 at 10:45
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

PJ3
  • 3,870
  • 1
  • 30
  • 34
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>
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.

Maksym Labutin
  • 561
  • 1
  • 8
  • 17
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

Haryono
  • 2,184
  • 1
  • 21
  • 14
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.

Terry Kernan
  • 746
  • 5
  • 12
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.

eselk
  • 6,764
  • 7
  • 60
  • 93
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

  • 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 [edit]ed your answer to explain how your answer works better than the other 12 (or at least how it is different). – Heretic Monkey Oct 21 '16 at 21:48
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.

Smileyfox
  • 86
  • 1
  • 2
-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.