WCF not running under IIS 6.0

前端 未结 6 2062
夕颜
夕颜 2021-02-04 03:20

Trying to get my WCF service running under IIS 6.

I have created the .svc and aspnet_isapi.dll mapping according to: http://msdn.microsoft.com/

6条回答
  •  花落未央
    2021-02-04 03:32

    There are two things I can think of:

    The .svc extension is not correctly set up (least probable according to your description). You can check this post for more details.

    Or your web site has multiple host headers. To resolve this issue, you must have a single host header or use a factory. Here’s an example:

    namespace MyNamespace
    {
        public class MultipleHostServiceFactory : ServiceHostFactory
        {
            protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            {
                List addresses = new List();
                addresses.Add(baseAddresses[0]);
                return base.CreateServiceHost(serviceType, addresses.ToArray());
            }
        }
    }
    

    Next, you need to set the factory in the markup of your .svc file:

    <%@ ServiceHost Language="C#" 
                    Debug="false" 
                    Factory="MyNamespace.MultipleHostServiceFactory" 
                    Service="MyNamespace.MyService" 
                    CodeBehind="MyService.svc.cs" %>
    

提交回复
热议问题