Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF app.config Service Name outside of Project
    primarykey
    data
    text
    <p>I am having a issue trying to create a WCF service. I am trying to put the services, data contracts, and service contracts in different projects. I keep getting "WCF Service Host cannot find any service metadata." error. Here is my appconfig file:</p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="SampleServiceContract.Service1"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress = "http://localhost:8732/Service1" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;!-- Service Endpoints --&gt; &lt;!-- Unless fully qualified, address is relative to base address supplied above --&gt; &lt;endpoint address ="" binding="wsHttpBinding" contract="SampleServiceContract.IService1"&gt; &lt;!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --&gt; &lt;identity&gt; &lt;dns value="localhost"/&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;!-- Metadata Endpoints --&gt; &lt;!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --&gt; &lt;!-- This endpoint does not use a secure binding and should be secured or removed before deployment --&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="True"/&gt; &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --&gt; &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; </code></pre> <p></p> <p>Here is my IService file:</p> <pre><code>// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. [ServiceContract] public interface IService1 { [OperationContract] string GetData(int value); [OperationContract] CompositeType GetDataUsingDataContract(CompositeType composite); // TODO: Add your service operations here } // Use a data contract as illustrated in the sample below to add composite types to service operations [DataContract] public class CompositeType { bool boolValue = true; string stringValue = "Hello "; [DataMember] public bool BoolValue { get { return boolValue; } set { boolValue = value; } } [DataMember] public string StringValue { get { return stringValue; } set { stringValue = value; } } } </code></pre> <p>Finally here is my Service1 file:</p> <pre><code>// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together. public class Service1 : IService1 { public string GetData(int value) { return string.Format("You entered: {0}", value); } public CompositeType GetDataUsingDataContract(CompositeType composite) { if (composite == null) { throw new ArgumentNullException("composite"); } if (composite.BoolValue) { composite.StringValue += "Suffix"; } return composite; } } </code></pre> <p>The app.config is under the namespace 'SampleWCF'. This is also the project name. My IService1 and Service1 files are under the namespace 'SampleServiceContract' which is also the project name.</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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