2016-08-14 6 views
0

cを私はこのコードをしようとするタイプ 'System.ServiceModel.CommunicationObjectFaultedException' の未処理の例外が WCF CommunicationObjectFaultedExceptionは#

System.ServiceModel.dll

で発生した

この例外を得た

 using (ServiceHost host = new ServiceHost(typeof(WcfProductService))) 
     { 
      host.Open(); 
      Console.WriteLine("server is open"); 
     } 

、app.config iのURLは

<endpoint address="http://localhost:9999/ProductSercie" binding="basicHttpBinding" 
     bindingConfiguration="" contract="IWcfProductService.IWcfProductService" 
     name="ProductServiceEndPoint" kind="" endpointConfiguration="" /> 

私はこの問題にserachと私は何をしてください行うことができますhttps://i.snag.gy/50tRok.jpg netshのではなく、成功 表情でCMDにこのURLを追加してみては? ありがとう

答えて

0

host.Open()は非同期であるため、ServiceHostオブジェクトを開いた直後にそのオブジェクトが破棄されたようです。 試してみてください。

using (ServiceHost host = new ServiceHost(typeof(WcfProductService))) 
    { 
     host.Open(); 
     Console.WriteLine("server is open"); 
     Console.ReadLine(); 
    } 
関連する問題