2010-03-26 77 views
0

我已經停止在IIS中的網站,在Web.config中做了一個改變,但該死的東西不斷寫我的日誌事件到我的數據庫!我發現的唯一解決方案是完全重新啓動IIS。這不是一個很好的解決方案,因爲那時我的所有網站都必須停止/重新啓動。如何停止WCF Web服務?

UPDATE

我已經做了一些挖四周,發現該服務使用的服務工廠。這是全班同學。

/// <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文件指向這個類作爲工廠。線索在這裏結束,但我不明白整個過程本身在哪裏運行。

回答

0

WCF Web服務運行的過程是什麼?你確定它是IIS嗎?它可能是別的嗎? WCF可以運行在許多不同的進程中。你必須弄清楚它的進程是什麼(它可能不一定是IIS)並且終止該進程以停止它。

+0

IIS是否在許多進程或AppDomain中運行? – kenny 2010-03-26 19:51:29

+0

我有一個通過雙面信息連接的Silverlight客戶端。我假定Web服務實例已連接到該網站。我如何檢測服務在哪個進程下運行?也有可能改變這個過程嗎? – Matt 2010-03-26 19:55:00

+0

@Matt:WCF服務可以自行託管。他們幾乎可以在任何類型的過程中運行。您必須知道該服務是在IIS中託管還是在單獨的進程中(可能位於Windows服務中)託管。 – 2010-03-26 20:01:43