Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
380 views
in Technique[技术] by (71.8m points)

internet explorer - How can I solve HTTP "404" and "405" error msgs?

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:projectgitCStoreHHS.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:projectgitCStoreHHS.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:projectgitCStoreHHS.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21608:" />
    </bindings>
</site>
<site name="HHS.API" id="4">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:projectgitCStoreHHS.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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 ].


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...