IIS 5.1 中的 WCF 作为纯文本文件
我刚刚在我的开发环境中设置了一个简单的 WCF 服务,到目前为止,对于 SOAP 和 JSONP 请求,端点工作正常。
我继续将此解决方案部署到托管在 IIS 5.1 上的临时服务器(我知道,但请耐心等待),.svc
文件突然不再工作。并不是 IIS 找不到它们,而是它们以纯文本文件的形式提供。
这基本上就是当我弹出 .svc
文件时在浏览器上显示的内容:
<%@ ServiceHost Language="C#" Debug="true" Service="service.myservice" CodeBehind="myservice.svc.cs" %>
现在我已经尝试了在 SO 和其他网站上看到的所有解决方案(包括重新安装 ASP.NET 绑定)在 IIS 上使用 aspnet_regiis
并使用 servicemodelreg.exe
恢复 WCF ISAPI 句柄),但它们都不起作用。
可能值得注意的一个怪癖是 IIS 5.1 在端口 8000 上提供服务,因为 Apache 当前在默认的 80 上运行。这可能是罪魁祸首吗?我尝试运行 servicemodelreg -s:myservice
来尝试直接访问我的应用程序路径,但它告诉我 IIS:/localhost/myservice
上没有这样的应用程序(也许是因为它应该位于 IIS:/localhost:8000/myservice
上?我不确定。)
我已经验证我已经拥有了一个功能性的 .NET 3.5 框架, .aspx
文件可以正常使用。只是 .svc
文件没有得到正确的服务。
有什么想法吗?
I just set up a simple WCF service on my dev environment, and so far the endpoints are working OK, for both SOAP and JSONP requests.
I've proceeded to deploy this solution to a staging server hosted on IIS 5.1 (old, I know, but bear with me), and the .svc
files suddenly aren't working anymore. Not that IIS can't find them, but rather they're getting served as plain text files.
This is basically what shows up on my browser when I pop in an .svc
file:
<%@ ServiceHost Language="C#" Debug="true" Service="service.myservice" CodeBehind="myservice.svc.cs" %>
Now I've tried all the solutions I've seen around SO and other sites (including reinstalling the ASP.NET binds on IIS using aspnet_regiis
and reinstating the WCF ISAPI handles using servicemodelreg.exe
), but none of them work.
One quirk that may be of note is that the IIS 5.1 is serving off port 8000, because Apache is currently running on the default 80. Could this be a culprit? I've tried running servicemodelreg -s:myservice
to try to hit my app path squarely, but it tells me that there's no such application on IIS:/localhost/myservice
(maybe because it's supposed to be on IIS:/localhost:8000/myservice
? I'm not sure.)
I've verified that I've got a functional .NET 3.5 framework down, the .aspx
files are served OK. It's just the .svc
files that aren't getting served properly.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 servicemodelreg 不起作用,请检查 .svc 是否已使用 ISAPI 映射进行设置。
转到网站属性上的“主目录”选项卡,选择“配置...”。
如果列表中不存在 .svc,请使用以下参数进行设置:
C:\WINDOWS\Microsoft。 NET\Framework\v2.0.50727\aspnet_isapi.dll
.svc
GET,HEAD,POST,DEBUG
If servicemodelreg hasn't worked, check that the .svc is set up with an ISAPI mapping.
Go to the Home Directory tab on the properties of your web site, select Configuration...
If .svc isn't present in the list, set it up with the following parameters:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
.svc
GET,HEAD,POST,DEBUG