How can I solve HTTP "404" and "405" error msgs?
K

1

3

Are HHTP "404" and "405" errors a step in the right direction following "400" Errors?

After changing my applicationhost.config file, based on step 3 in this article, from this:

<site name="HHS.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21608:localhost" />
        <binding protocol="http" bindingInformation="*:21608:shannon2" />
    </bindings>
</site>
<site name="HHS.API" id="4">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.API" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21609:localhost" />
        <binding protocol="http" bindingInformation="*:21609:shannon2" />
    </bindings>
</site>

...to this:

<site name="HHS.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21608:" />
    </bindings>
</site>
<site name="HHS.API" id="4">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.API" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21609:" />
    </bindings>
</site>

...and restarting IIS Express after this rigamarole (step 4 in the same article referenced above):

enter image description here

....I get when running may app, instead of my previous err ("400 - Bad Request") a different but more common problem: "404 - Not Found"

However, if I enter the URL into IE on the handheld device and run it, I get, "405 - Resource Not Allowed"

Does anybody know how to solve this dilemma / can anybody see a problem with what I'm doing here?

UPDATE

As to testing various URLs from the PC's (Chrome) browser, here are what I tried and their results:

// hostname / machine name:
"http://shannon2:21608/api/inventory/sendxml/bla/bla/bla" gives me:

HTTP Error 503. The service is unavailable.

// IP Address:
"http://192.168.125.50:21608/api/inventory/sendxml/bla/bla/bla" gives me:

<Error>
<Message>
The requested resource does not support http method 'GET'.
</Message>
</Error>

// locohost:
"http://localhost:21608/api/inventory/sendxml/bla/bla/bla" gives me the same response as using the IP Address (192.168.125.50) above.

// locohost as IP Address
"http://127.0.0.1:21608/api/inventory/sendxml/bla/bla/bla" also gives me the same response as using the IP Address (192.168.125.50) or localhost as shown above.

UPDATE 2

Trying to access the resource via the (IE) browser from the handheld device:

Using 127.0.0.1 within the URL causes the browser to respond with "Cannot find server or DNS error"

Using 192.168.125.50 (my PC's IP Address) responds with "HTTP 405 - Resource not found"

UPDATE 3

In the Gretelman post referenced in the answer (here) it says to do this:

netsh http add urlacl url=http://hanselman-w500:80/ user=everyone

...from a command prompt; which, in my case, would be:

netsh http add urlacl url=http://shannon2:80/ user=everyone

But doesn't that only open attempts to access port 80? I need to access the port the REST Web API method expects, namely 21608...

Should I be doing this:

netsh http add urlacl url=http://shannon2:21608/ user=everyone

?

UPDATE 4

I can perform the following at a command prompt with no errors:

iisexpress.exe site:"HHS.Web"

It is shown as running in IIS Express -- actually, HSS.Web was up prior to running that command (as I could see by right-clicking the IIS Express taskbar icon and selecting "Show All Applications"), along with HHS.API, but I ran it to see if it would return any err msgs, according to what is suggested here

UPDATE 5

As a follow-up to Update 3 in particular, it was either this:

netsh http add urlacl url=http://shannon2:80/ user=everyone

...or this:

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

...that did the trick - I am now finally able to hit the breakpoint on the server from the handheld after running those commands (opening up ports 80 and 8080 to the masses using my machine's hostName). Which was necessary, or whether they both were, I don't know. I had already added the commands for "21608" and "21609" so they were not the solution:

enter image description here

Kernel answered 16/9, 2014 at 21:33 Comment(0)
D
1

When considering exposing connections to your IIS Express App Instances over your network/domain, you'll have to modify HTTP.SYS and your firewall inbound rules.

Also, I recommended that you use your computer name in your binds.

Here is a reference article covering this configuration, as well as other considerations: http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

The article covers giving external traffic access to IIS Express instances on the standard port 80 using two methods/process (labeled Easy & Ninja/Hard). It also covers the process of trusting self-signed certificates and ASP.NET URL rewrite rules for accessing and handling connections over https (SSL) to your app instances.

It's quite verbose, and I'll probably update this answer with that information if it provides you with the information you require. (which I presume it will)..

EDIT:

It would seem the most appropriate article covering your issue (that you resolved at this point) was [ http://www.iis.net/learn/extensions/using-iis-express/handling-url-binding-failures-in-iis-express ], as referenced by the SO Post [ Configure IIS Express for external access to VS2010 project ].

Dunant answered 16/9, 2014 at 21:58 Comment(7)
I need to access my PC, whose IP Address is 192.168.125.50, and a REST call that requires a port number of 21608.Kernel
that's fine.. but accessing your computer using your network address (router assigned) means, of course, network accessibility to IIS Express on that port. consider dropping your firewall throughout your testing. Refer to this SO Post: #5434286 on configuration applicationhost.config fileDunant
The answer lyes with modifying HTTP.SYS to allow external traffic to IIS Express, and of course, bindings using the applicationhost.configDunant
"get your app started and running again, then try 127.0.0.1:21608 in your address bar for your HHS.WEB site/instance.. and 127.0.0.1:21609 for your HHS.API app instance." I'll try that, but I think 127.0.0.1 is essentially the same as localhost, so the handheld device will look for that port on itself, not on my PC to which it is attached via USB and ActiveStync.Kernel
I didn't catch the 'handheld' remark in your question before.. I was just trying to have you be explicit as to what 'URL' you were using/typing in.. it was supposed to be a comment afterall :PDunant
See my Update and Update 2Kernel
As for Hanselmann's article, it looks promising but I don't need/use SSL, so I don't know if it's applicable to my sit[e,uation].Kernel

© 2022 - 2024 — McMap. All rights reserved.