{"id":5445,"date":"2014-03-30T22:02:36","date_gmt":"2014-03-30T22:02:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/trying-to-self-host-i-get-error-wcf-service-host-cannot-find-any-service-metadata-please-check-if-metadata-is-enabled-collection-of-common-programming-errors\/"},"modified":"2014-03-30T22:02:36","modified_gmt":"2014-03-30T22:02:36","slug":"trying-to-self-host-i-get-error-wcf-service-host-cannot-find-any-service-metadata-please-check-if-metadata-is-enabled-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/trying-to-self-host-i-get-error-wcf-service-host-cannot-find-any-service-metadata-please-check-if-metadata-is-enabled-collection-of-common-programming-errors\/","title":{"rendered":"Trying to self-host, I get error &#8211; wcf service host cannot find any service metadata .. please check if metadata is enabled-Collection of common programming errors"},"content":{"rendered":"<p>I am new to WCF and I&#8217;ve read answers to questions with titles similar to my error but I still cannot see what is wrong.<\/p>\n<p>Following some other tutorials I decided to put my contract and my service in separate projects. Ultimately, I would like to host this in IIS but for now I just wanted to get the WCF Service Host to start (and WCF Test Client).<\/p>\n<p>Here is the <strong>app.config<\/strong> in my <strong>service<\/strong> project (would this need to be in my <strong>contract<\/strong> project too I wonder??&#8230;):<\/p>\n<pre><code>\n\n  \n    \n  \n  \n    \n      \n        \n        \n        \n        \n          \n            \n          \n        \n      \n    \n    \n      \n        \n          \n          \n        \n      \n    \n  \n  \n    \n  \n\n<\/code><\/pre>\n<p>Here is the beginning of the FileService.cs file in my <strong>services<\/strong> project:<\/p>\n<pre><code>using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.ServiceModel;\nusing System.IO;\nusing System.Diagnostics;                       \/\/ needed for writing to EventLog.\nusing System.Text;                              \/\/ needed for StringBuilder\nusing System.ComponentModel;\nusing System.Web;                               \/\/ need to target .Net Framework 4.0 for the    project (for HttpContext)\n\nusing TRIMSDK;                                  \/\/ for TRIM 6.2. 7.1 (the \"COM\" SDK)\nusing CBMI.TrimWCF.Utilities;                   \/\/ separate project for misc classes\nusing CBMI.TrimWCF.FileServiceContract;\nnamespace CBMI.TrimWCF.FileService\n{\n[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]\npublic class FileService : IFileService\n{\n    Database db;\n    string g_EventSource = \"CBMI-TrimBroker\";\n    string g_EventLog = \"Application\";\n\n    public FileService()\n    {\n<\/code><\/pre>\n<p>Finally, here is a bit of my IFileService.cs file in my <strong>contracts<\/strong> project:<\/p>\n<pre><code>using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Serialization;\nusing System.ServiceModel;\nusing System.Text;\n\nnamespace CBMI.TrimWCF.FileServiceContract\n{\n    [ServiceContract(Name = \"IFileService\", Namespace = \"http:\/\/www.cbmiweb.com\/TrimWCF\/2011\/11\")]\n    public interface IFileService\n    {\n        [OperationContract]\n        string GetData(int value);\n\n        [OperationContract]\n        CompositeType GetDataUsingDataContract(CompositeType composite);\n\n    [OperationContract]\n    string DownloadFile(string trimURL\n            , string TrimRecordNumber\n            , string CallerPC\n            , string RequestorID\n            , out byte[] docContents\n            , out string returnFiletype\n            , out string returnFilename);\n    [OperationContract]\n    void DownloadFileCF(string trimURL\n            , string TrimRecordNumber\n            , string CallerPC = \"not specified\"\n            , string RequestorID = \"not specified\");\n    [OperationContract]\n    string SearchCF(string trimURL\n            , string CFSearchString\n            , string CallerPC\n            , string RequestorID);\n    [OperationContract]\n    string UploadFileCF(string trimURL\n            , byte[] incomingArray\n            , string fileName\n            , string TrimRecordTypeName\n            , string metaDataString);\n    [OperationContract]\n    string UpdateRecordCF(string trimURL\n            , string TrimRecordNumber\n            , string metaDataString);\n}\n\n[DataContract(Name = \"WCFsample\", Namespace = \"http:\/\/www.cbmiweb.com\/TrimWCF\/2011\/11 \")]\npublic class CompositeType\n{\n    bool boolValue = true;\n    string stringValue = \"Hello \";\n\n    [DataMember]\n    public bool BoolValue\n    {\n        get { return boolValue; }\n        set { boolValue = value; }\n    }\n\n    [DataMember]\n    public string StringValue\n    {\n        get { return stringValue; }\n        set { stringValue = value; }\n    }\n}\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am new to WCF and I&#8217;ve read answers to questions with titles similar to my error but I still cannot see what is wrong. Following some other tutorials I decided to put my contract and my service in separate projects. Ultimately, I would like to host this in IIS but for now I just [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5445","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5445"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5445\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}