Thursday, January 25, 2007

Hello word WCF service project ( service.Metadata publishing for this service is currently disabled. )

Today I’m just trying to experiment with WCF service project. While I trying to add service reference its show following error

“This is a Windows© Communication Foundation service.Metadata publishing for this service is currently disabled.”

I solved it by changing web.config of service project following tag

Add “<“serviceMetadata httpGetEnabled="true" /> tag

“<“serviceBehaviors>
“<“behavior name="returnFaults" >
“<“serviceMetadata httpGetEnabled="true" />
“<“/behavior>
“<“/serviceBehaviors>

And two atribute(binding="mexHttpBinding" address="mex") in
“<“endpoint contract="IMyService" binding="mexHttpBinding" address="mex"/>

Default Web.config

“<“?xml version="1.0"?>

“<“configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
“<“system.serviceModel>
“<“services>
“<“!-- Before deployment, you should remove the returnFaults behavior configuration to avoid disclosing information in exception messages -->
“<“service name="MyService" behaviorConfiguration="returnFaults">
“<“endpoint contract="IMyService" binding="wsHttpBinding"/>
“<“/service>
“<“/services>
“<“behaviors>
“<“serviceBehaviors>
“<“behavior name="returnFaults" >
“<“serviceDebug includeExceptionDetailInFaults="true" />
“<“/behavior>
“<“/serviceBehaviors>
“<“/behaviors>
“<“/system.serviceModel>

“<“system.web>
“<“compilation debug="true"/>
“<“/system.web>

“<“/configuration>

Changed Web.config

“<“?xml version="1.0"?>

“<“configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
“<“system.serviceModel>
“<“services>
“<“!-- Before deployment, you should remove the returnFaults behavior configuration to avoid disclosing information in exception messages -->
“<“service name="MyService" behaviorConfiguration="returnFaults">
“<“endpoint contract="IMyService" binding="mexHttpBinding" address="mex"/>
“<“/service>
“<“/services>
“<“behaviors>
“<“serviceBehaviors>
“<“behavior name="returnFaults" >
“<“serviceDebug includeExceptionDetailInFaults="true" />
“<“serviceMetadata httpGetEnabled="true" />

“<“/behavior>
“<“/serviceBehaviors>
“<“/behaviors>
“<“/system.serviceModel>

“<“system.web>
“<“compilation debug="true"/>
“<“/system.web>

“<“/configuration>

0 comments: