Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 在Windows Server 2012 R2和IIS 8.5上从未调用自定义ServiceHostFactory_Wcf_Iis_Windows Server 2012 R2_Iis 8.5 - Fatal编程技术网

Wcf 在Windows Server 2012 R2和IIS 8.5上从未调用自定义ServiceHostFactory

Wcf 在Windows Server 2012 R2和IIS 8.5上从未调用自定义ServiceHostFactory,wcf,iis,windows-server-2012-r2,iis-8.5,Wcf,Iis,Windows Server 2012 R2,Iis 8.5,我有一个带有自定义ServiceHostFactory的WCF服务解决方案(NET 4),它在我的开发人员计算机(Windows 8.1和IIS 8.5)上运行良好,但由于某些原因,我无法使其在Windows Server 2012和IIS 8.5上运行。WCF服务本身在服务器2012上工作,但从未调用ServiceHostFactory。我是否应该通过在Server2012中添加角色或功能来安装特定模块,以使其正常工作 public class InternalAHostFactory : S

我有一个带有自定义ServiceHostFactory的WCF服务解决方案(NET 4),它在我的开发人员计算机(Windows 8.1和IIS 8.5)上运行良好,但由于某些原因,我无法使其在Windows Server 2012和IIS 8.5上运行。WCF服务本身在服务器2012上工作,但从未调用ServiceHostFactory。我是否应该通过在Server2012中添加角色或功能来安装特定模块,以使其正常工作

public class InternalAHostFactory : ServiceHostFactory
{
    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    {
        ServiceHost host = base.CreateServiceHost(serviceType, baseAddresses);
        host.Opening += new EventHandler(host_Opening);
        return host;
    }

    void host_Opening(object sender, EventArgs e)
    {
        // This is never called on Windows Server 2012 R2 and IIS 8.5 but works on Windows 8.1 and IIS 8.5
    }

}

在我的案例中,通过服务器管理器添加完整的“WCF服务”功能集解决了这个问题。

您能显示使服务器使用您的工厂的配置行吗?我没有在web.config中指定它,但它仍然可以在我的开发人员机器上运行,甚至在另一台服务器上运行,但就这台服务器2012而言,它无法工作。我在.svc文件中指定了Factory=“Internal.InternalAHostFactory”