Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to add refrence of restful wcf service in windows service
    primarykey
    data
    text
    <p>When i tried to add the reference of restful wcf service to windows service. I am getting "The type or namespace name 'RestfulService' could not be found (are you missing a using directive or an assembly reference?)" error.</p> <p><strong>MY Interface Is</strong></p> <pre><code>[ServiceContract(Name = "RJContract", Namespace = "RestfulService", SessionMode = SessionMode.Allowed)] public interface IService1 { [OperationContract] [WebGet(UriTemplate = "/rjdata/{name}")] string RJData(string name); } </code></pre> <p><strong>App.Config</strong></p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="RestfulService.Service1"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress = "http://localhost:8732/RestfulService/Service1/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint binding="webHttpBinding" contract="RestfulService.IService1" bindingConfiguration="RESTBindingConfiguration" behaviorConfiguration="RESTEndpointBehavior"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;webHttpBinding&gt; &lt;binding name="RESTBindingConfiguration"&gt; &lt;security mode="None" /&gt; &lt;/binding&gt; &lt;/webHttpBinding&gt; &lt;netTcpBinding&gt; &lt;binding name="DefaultBinding"&gt; &lt;security mode="None"/&gt; &lt;/binding&gt; &lt;/netTcpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;endpointBehaviors&gt; &lt;behavior name="RESTEndpointBehavior"&gt; &lt;webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true"/&gt; &lt;/behavior&gt; &lt;/endpointBehaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;serviceMetadata httpGetEnabled="True"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /&gt; &lt;/system.serviceModel&gt; </code></pre> <p>But i am able to add the reference with the following.</p> <pre><code> [ServiceContract(Name = "RJContract", Namespace = "RestfulService", SessionMode = SessionMode.Allowed)] public interface IService1 { [OperationContract] string RJData(string name); } </code></pre> <p><strong>In windows Hosting</strong></p> <pre><code>public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } ServiceHost sHost; protected override void OnStart(string[] args) { try { sHost = new ServiceHost(typeof(RestfulService.Service1)); sHost.Open(); } catch (Exception ex) { EventLog.WriteEntry(ex.Message); } } protected override void OnStop() { } } </code></pre> <p>where RestfulService is my reference to the wcf service</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload