Note that there are some explanatory texts on larger screens.

plurals
  1. POVB.NET solution to - " WCF service default project setup example does not work"
    primarykey
    data
    text
    <p>I know this has been asked before and I've went through 2 of the only answered questions here with a fine tooth comb, and many hours later trying every possible solution, I'm still not able to get the default WCF project to work on VS2012 (see error in title).</p> <p>In a nutshell: All I want to do is get the default WCF Application project to work in VisualStudio 2012 Pro.</p> <p>What I've tried: Changing the WEB.CONFIG end to add the following (this apparently, works for most, but not me)</p> <pre><code>&lt;services&gt; &lt;service behaviorConfiguration="metadataBehavior" name="Service1"&gt; &lt;endpoint address="" binding="customBinding" bindingConfiguration="jsonpBinding" contract="Service1.IService1"/&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; </code></pre> <p></p> <p>And the following:</p> <pre><code> &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="metadataBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; </code></pre> <p></p> <p>The iService1.vb code (didn't change the default):</p> <pre><code>&lt;ServiceContract()&gt; Public Interface IService1 &lt;OperationContract()&gt; Function GetData(ByVal value As Integer) As String &lt;OperationContract()&gt; Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType ' TODO: Add your service operations here End Interface &lt;DataContract()&gt; Public Class CompositeType &lt;DataMember()&gt; Public Property BoolValue() As Boolean &lt;DataMember()&gt; Public Property StringValue() As String End Class </code></pre> <p>The markup for the Service1.svc:</p> <pre><code> &lt;%@ ServiceHost Language="VB" Debug="true" Service="WcfService1.Service1" CodeBehind="Service1.svc.vb" %&gt; </code></pre> <p>Which, incidentally, has a long blue squiggly line indicating "Unrecognized configuration section services. (E:\projects\TestJquery\WcfService1\web.config line 35) " so I need something else here - another project reference?</p> <p>Here's the complete web.config file (the only thing that changed was the recommended addition of the "services" section)</p> <pre><code> &lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt; &lt;/appSettings&gt; &lt;system.web&gt; &lt;compilation debug="true" strict="false" explicit="true" targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5"/&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="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; &lt;protocolMapping&gt; &lt;add binding="basicHttpsBinding" scheme="https" /&gt; &lt;/protocolMapping&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;!-- To browse web app root directory during debugging, set the value below to true. Set to false before deployment to avoid disclosing web app folder information. --&gt; &lt;directoryBrowse enabled="true"/&gt; &lt;/system.webServer&gt; &lt;services&gt; &lt;service behaviorConfiguration="metadataBehavior" name="Service1"&gt; &lt;endpoint address="" binding="customBinding" bindingConfiguration="jsonpBinding" contract="Service1.IService1"/&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="metadataBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/configuration&gt; </code></pre> <p>I figure, if I could just get the default WCF webservice project to work, I could better dissect and understand what is going on. If anyone has done this, please send a zip file of your working, functioning default VS2012 solution (or a link). I really want to get away from ASMX web services, the lexicon of WCF doesn't seem to make any sense.</p> <p>web.config changes - still no workie, but no blue squigglies :)</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt; &lt;/appSettings&gt; &lt;system.web&gt; &lt;compilation debug="true" strict="false" explicit="true" targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5"/&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="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;behavior name="metadataBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;services&gt; &lt;service behaviorConfiguration="metadataBehavior" name="WcfService1.Service1"&gt; &lt;endpoint address="" binding= "basicHttpBinding" /&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;protocolMapping&gt; &lt;add binding="basicHttpsBinding" scheme="https" /&gt; &lt;/protocolMapping&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;!-- To browse web app root directory during debugging, set the value below to true. Set to false before deployment to avoid disclosing web app folder information. --&gt; &lt;directoryBrowse enabled="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>FINAL WEB.CONFIG settings necessary for default, out of the box, VS2012 WCF Web Service Application to work. I hope this helps all the newbies like me to at least have something to tweak with while learning WCF:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;appSettings&gt; &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt; &lt;/appSettings&gt; &lt;system.web&gt; &lt;compilation debug="true" strict="false" explicit="true" targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5"/&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="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;behavior name="metadataBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;services&gt; &lt;service behaviorConfiguration="metadataBehavior" name="WcfService1.Service1"&gt; &lt;endpoint address="" binding= "basicHttpBinding" contract="WcfService1.IService1" /&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;protocolMapping&gt; &lt;add binding="basicHttpsBinding" scheme="https" /&gt; &lt;add binding="basicHttpBinding" scheme="http" /&gt; &lt;/protocolMapping&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;!-- To browse web app root directory during debugging, set the value below to true. Set to false before deployment to avoid disclosing web app folder information. --&gt; &lt;directoryBrowse enabled="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre>
    singulars
    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