WCF: Enable WSDL on a WCF Service (Ajax-enabled)

WCF Service (Ajax-enabled):

   <system.serviceModel>
      <behaviors>
         <endpointBehaviors>
            <behavior name="MyServiceAspNetAjaxBehavior">
               <enableWebScript />
            </behavior>
         </endpointBehaviors>
      </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <services>
         <service name="MyService">
            <endpoint address="" behaviorConfiguration="MyServiceAspNetAjaxBehavior"
               binding="webHttpBinding" contract="MyService" />
         </service>
      </services>
   </system.serviceModel>

WCF Service (Ajax-enabled) – with WSDL / Metadata enabled:

   <system.serviceModel>
      <behaviors>
         <endpointBehaviors>
            <behavior name="MyServiceAspNetAjaxBehavior">
               <enableWebScript />
            </behavior>
         </endpointBehaviors>
         <serviceBehaviors>
           <behavior name="MyServiceMexBehavior" >
             <serviceMetadata httpGetEnabled="true" />
           </behavior>
         </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <services>
         <service name="MyService" behaviorConfiguration="MyServiceMexBehavior">
            <endpoint address="" behaviorConfiguration="MyServiceAspNetAjaxBehavior"
               binding="webHttpBinding" contract="MyService" />
            <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
         </service>
      </services>
   </system.serviceModel>

The End.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: