From the configuration and code you posted, it looks good. I assume that the WCF service is a .svc based service hosted in web application, correct? If so, have you tried using web browser to view the .svc file to see whether it can show you the default
description page and WSDL page?
The following reference shows how to configure metadata for WCF service:
For troubleshooting, you can use fiddler tool to watch the HTTP traffice between browser and the service to see if there is any more detailed error info.
in addition, if there is any error, exception occured in service, you can also use the WCF tracing to log the errors. And if possible, it is more convenient that you directly use visual studio to debug the service.
gopikrsna
Member
190 Points
234 Posts
ailed to add a service. Service metadata may not be accessible
Apr 01, 2012 07:29 AM|LINK
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel > <services> <service name="CalculatorWcfServiceWeb.CalculatorService.Service" behaviorConfiguration="myBehav"> <endpoint address="SOAP" binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="CalculatorWcfServiceWeb.CalculatorService.Service"/> <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /> </service> </services> <bindings> <wsHttpBinding> <binding name="wsHttp"> <security mode="Message"> <message clientCredentialType="UserName"/> </security> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="myBehav"> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="CalculatorWcfServiceWeb.CalculatorService.SampleValidator,CalculatorWcfServiceWeb.CalculatorService" cacheLogonTokens="true" cachedLogonTokenLifetime="01:00:00"/> </serviceCredentials> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="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"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>Ken Tucker
All-Star
16797 Points
2608 Posts
MVP
Re: ailed to add a service. Service metadata may not be accessible
Apr 01, 2012 10:55 AM|LINK
It looks like your wcf service should show the wsdl. Are you sure the types you are returning from the service are serializable?
Space Coast .Net User Group
Steven Cheng...
Contributor
4199 Points
548 Posts
Microsoft
Moderator
Re: ailed to add a service. Service metadata may not be accessible
Apr 03, 2012 02:57 AM|LINK
Hi gopikrsna,
From the configuration and code you posted, it looks good. I assume that the WCF service is a .svc based service hosted in web application, correct? If so, have you tried using web browser to view the .svc file to see whether it can show you the default description page and WSDL page?
The following reference shows how to configure metadata for WCF service:
#How to: Publish Metadata for a Service Using a Configuration File
http://msdn.microsoft.com/en-us/library/ms734765.aspx
For troubleshooting, you can use fiddler tool to watch the HTTP traffice between browser and the service to see if there is any more detailed error info.
#Fiddler web debugger
http://www.fiddler2.com/fiddler2/
in addition, if there is any error, exception occured in service, you can also use the WCF tracing to log the errors. And if possible, it is more convenient that you directly use visual studio to debug the service.
#Service Trace Viewer Tool (SvcTraceViewer.exe)
http://msdn.microsoft.com/en-us/library/ms732023.aspx
Feedback to us
Microsoft One Code Framework