如何停止WCF Web服务?

时间:2010-03-26 19:47:12

标签: wcf web-services iis

我已经停止了IIS中的网站,在Web.config中进行了更改,但该死的东西一直在将我的日志事件写入我的数据库!我发现的唯一解决方案是完全重启IIS。这不是一个很好的解决方案,因为我的所有网站都必须停止/重启。

更新

我已经做了一些挖掘并找到了服务使用的servicefactory。这是整个班级。

/// <summary>
/// Derive from this class to create a duplex Service Factory to use in an .svc file
/// </summary>
/// <typeparam name="T">The Duplex Service type (typically derived from DuplexService)</typeparam>
public abstract class DuplexServiceFactory<T> : ServiceHostFactoryBase where T : IUniversalDuplexContract, new()
{
    T serviceInstance = new T();

    /// <summary>
    /// This method is called by WCF when it needs to construct the service.
    /// Typically this should not be overridden further.
    /// </summary>
    public override ServiceHostBase CreateServiceHost( string constructorString, Uri[] baseAddresses )
    {
        ServiceHost service = new ServiceHost( serviceInstance, baseAddresses[ 0 ] );
        CustomBinding binding = new CustomBinding(
                                new PollingDuplexBindingElement(),
                                new BinaryMessageEncodingBindingElement(),
                                new HttpTransportBindingElement()
                                );

        service.Description.Behaviors.Add( new ServiceMetadataBehavior() );
        service.AddServiceEndpoint( typeof( IUniversalDuplexContract ), binding, "" );
        service.AddServiceEndpoint( typeof( IMetadataExchange ), MetadataExchangeBindings.CreateMexHttpBinding(), "mex" );
        return service;
    }
}

这只会返回一个新的服务实例,但至于谁正在进行通话,我不知道。我的SVC文件指向此类作为工厂。这条路径在这里结束,但我不明白整个过程本身在哪里运行。

1 个答案:

答案 0 :(得分:0)

您的WCF Web服务在哪个进程中运行?你确定它是IIS吗?它可能是别的吗? WCF可以在许多不同的进程中运行。你必须弄清楚它在哪个进程(它可能不一定是IIS)并杀死该进程以使其停止。