无法调试WCF服务应用程序当WebMessageFormat是Json时

时间:2014-04-28 06:26:16

标签: c# json wcf visual-studio-2012

我无法调试WCF服务App。来自visual studio 2012,当我尝试播放时,它给了我以下错误。

  

"无法添加服务。可能无法访问服务元数据。使   确保您的服务正在运行并公开元数据。"

请注意,当我将Operation Contract中的WebMessageFormat更改为Json

时,我收到此错误
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getServicesSubList")]

的Web.Config

enter code here
<?xml version="1.0"?>
<configuration>
 <connectionStrings>
 <add name="wmas_subsConnectionString" connectionString="Data Source=HAMMAD- PC\SQLEXPRESS;Initial Catalog=wmas_subs;User ID=sa;Password=radius123?"  providerName="System.Data.SqlClient"/>
 </connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation targetFramework="4.5" debug="true"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
  <service name="ClientService.ClientService"  behaviorConfiguration="ClientService.ServiceBehavior">
    <endpoint address="" 
              binding="webHttpBinding"  bindingConfiguration="webHttpBindingConfiguration"
              contract="ClientService.IClientService"  behaviorConfiguration="webBehaviour" />
    <endpoint address="stream" 
              binding="webHttpBinding" bindingConfiguration="webHttpBindingConfigurationStreamed"
              contract="ClientService.IClientService" behaviorConfiguration="webBehaviour"/>
    <endpoint address="mex" 
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
   </service>
 </services>
 <bindings>
  <webHttpBinding>
    <binding name ="webHttpBindingConfiguration">
      <!--<security mode="Transport" />-->          
    </binding>
    <binding name ="webHttpBindingConfigurationStreamed"  transferMode="StreamedResponse" />
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="ClientService.ServiceBehavior">
      <!-- To avoid disclosing metadata information, set the values below to false   before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <!-- 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 -- >
       <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceAuthorization serviceAuthorizationManagerType="ClientService.CustomUserNamePasswordValidator, ClientService" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="webBehaviour">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
 </behaviors>
 <protocolMapping>
  <add binding="basicHttpsBinding" scheme="https"/>
  </protocolMapping>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"  multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
 <modules runAllManagedModulesForAllRequests="true"/>
 <!--
    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.
  -->
 <directoryBrowse enabled="true"/>
</system.webServer>
</configuration>

enter image description here

0 个答案:

没有答案