问题
I have IIS 6.0 on Windows Server 2003.
I installed .NET 3.5 and 4 beta 2. "Normal" ASP things are working (perfect). But when I try to navigate to my service (/myServer/MyService.svc
) I get a 404. Page not found.
To be exact, I got a 404 2 "Web service extension lockdown policy prevents this request."
I used ServiceModelReg.exe /ia
to make sure that the extension I known and I checked the configuration using:
admin-Tools, iis, home-tab, configuration, executable-box, and there:
Extension: .svc, path: c:\windows\microsoft.net\framework\v4.0.210...
, verbs: all verbs.
So everything seems OK. But I still get a 404-2.
回答1:
Your "web service extension lockdown policy" is preventing the ASP.NET 4.0 ISAPI extension from processing your request. It happened to me, check it out:
C:\>cscript c:\WINDOWS\system32\iisext.vbs /ListFile
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Connecting to server ...Done.
Status / Extension Path
------------------------
0 C:\WINDOWS\system32\inetsrv\httpodbc.dll
0 C:\WINDOWS\system32\inetsrv\ssinc.dll
0 C:\WINDOWS\system32\inetsrv\asp.dll
1 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
0 *.exe
0 C:\WINDOWS\system32\inetsrv\httpext.dll
0 *.dll
1 C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
1 C:\WINDOWS\system32\MQISE.DLL
0 C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
Do you have a "0" next to the v4.0 aspnet_isapi.dll like I did? There's your problem. You need to enable it:
C:\>cscript c:\WINDOWS\system32\iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Frame
work64\v4.0.30319\aspnet_isapi.dll
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Connecting to server ...Done.
Enabling extension file complete.
For more info on the iisext.vbs tool: http://support.microsoft.com/kb/328419/
回答2:
Can you show us your server-side web.config (just the <system.serviceModel>
section)? Where on your server does your service live?
When hosting in IIS, your service address is defined by:
- server name (or IP address)
- name of the virtual directory (plus any subdirectories under that) in which your *.svc file lives
- the *.svc file itself
So it would be something like:
http://YourServer/YourVirtualDirectory/MyService.svc
You don't seem to use a virtual directory in the path you mention - is your *.svc file really in the root of the web server, or did you forget to add the virtual directory to your path?
回答3:
The information in this blog post proved invaluable to getting this to work.
http://xamlcoder.com/blog/?p=7
I am not sure about IIS6 but I created a new website in IIS7 (I could not get things to work under a virtual directory but that is probably my lack of IIS knowledge) I put my .svc file in the root directory and in ~/Services/
Everything started working great.
The blog mentioned that IIS should look in ~/Services/ automatically anytime a .svc file is served up but that was not working. That is why I simply copied the .svc file to my website root.
Hope this helps.
来源:https://stackoverflow.com/questions/2009233/how-to-deploy-wcf-service-on-iis-6-0