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?
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:
- Executable:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
- Extension:
.svc
- Limit to:
GET,HEAD,POST,DEBUG
- Script engine: Ticked
精彩评论