IIS状态200(浏览器) - 404(Wcf) [英] IIS status 200(Browser) - 404(Wcf)
问题描述
我有一个WCF服务,IIS托管。它受基本身份验证保护。
I have a WCF service, IIS hosted. It is protected with Basic Authentication.
当我使用浏览器浏览时,我得到401(非挑战)和200(成功回复)。
相同的网站,页面等,通过控制台应用程序发出WCF请求,我得到401,然后是404(找不到页面)。
When I browse with a browser, I get a 401 (nt challenge) and a 200 (successful response). The same website, page etc, with a WCF request via a console app, I get 401, then 404 (page not found).
两者都使用相同的用户名和密码是正确的。该机器只是一个开发桌面。不在域名上。主机是hostwebsite.local通过主机文件绑定到127.0.0.1
Both use the same username and password which are correct. The machine is just a desktop for development. Not on a domain. The host is hostwebsite.local via host file binding to 127.0.0.1
这是IIS日志。
前两行是调用失败的WCF。最后两行是成功的浏览器调用。
Here are the IIS logs. The first two lines are the failed WCF called. The last 2 lines is the successful browser call.
唯一真正的区别是GET / POST。身份验证是匿名的时,WCF可以正常工作。
The only real difference is the GET/POST. The WCF works when authentication is anonymous.
如何调试此问题?谢谢。
How can I debug this issue? thank you.
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2011-03-31 22:53:58
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2011-03-31 22:56:37 W3SVC2 MIKEV-WS 127.0.0.1 POST /Services/EchoService.svc - 80 - 127.0.0.1 HTTP/1.1 - - - hostwebsite.local 401 2 5 6633 362 3
2011-03-31 22:56:37 W3SVC2 MIKEV-WS 127.0.0.1 POST /Services/EchoService.svc - 80 admin 127.0.0.1 HTTP/1.1 - - - hostwebsite.local 404 0 0 210 568 2
2011-03-31 22:57:07 W3SVC2 MIKEV-WS 127.0.0.1 GET /Services/EchoService.svc - 80 - 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US)+AppleWebKit/534.16+(KHTML,+like+Gecko)+Chrome/10.0.648.133+Safari/534.16 - - hostwebsite.local 401 2 5 6633 442 1
2011-03-31 22:57:10 W3SVC2 MIKEV-WS 127.0.0.1 GET /Services/EchoService.svc - 80 admin 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US)+AppleWebKit/534.16+(KHTML,+like+Gecko)+Chrome/10.0.648.133+Safari/534.16 - - hostwebsite.local 200 0 0 1287 485 23
新信息
问题现已解决,我已在下面列出答案。
New Information
Problem is now solved and I have listed the answer below.
推荐答案
有一个配置错误导致侦听服务器侦听 http://hostwebsite.local/Services/EchoService.svc/Services/EchoService.svc
There was a configuration error causing the listening server to listen on http://hostwebsite.local/Services/EchoService.svc/Services/EchoService.svc
而不是
http://hostwebsite.local/Services/EchoService.svc
我清除了服务器端点中的地址 /Services/EchoService.svc
I cleared the address in the server endpoint which was /Services/EchoService.svc
<services>
<service name="API.Proxy.EchoProxy" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="[CLEARED]" binding="basicHttpBinding" contract="API.Contract.IEcho" bindingConfiguration="NewBinding" />
客户端配置已经有了地址
The client config already had the address
<client>
<endpoint address="http://hostwebsite.local/Services/EchoService.svc" binding="basicHttpBinding" bindingConfiguration="SecureBinding" contract="API.Contract.IEcho" name="SecureEndpoint">
这篇关于IIS状态200(浏览器) - 404(Wcf)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!