Answered by:
Error in WCF(Error while downloading meta data from the address)

Question
-
User1086292807 posted
Hi i am trying to do demo on Message Security.for that i used the URL http://www.codeproject.com/Articles/36732/WCF-FAQ-Part-3-10-security-related-FAQ
i have created whatever maintioned in the URL.i have create wcf webservice and webapplication as client and create the certificate that is required for client as well as server but i am getting error while adding service referece in client application and error is
Error:-
there was an error downloading metadata from address.
Please verify that you have entered a valid addresswhen i click on details of error then it show me following message
Details of Error:-
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://localhost:5451/Service1.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:5451/Service1.svc. The client and service bindings may be mismatched.
The remote server returned an error: (415) Unsupported Media Type.
If the service is defined in the current solution, try building the solution and adding the service reference again.setting in Service WebConfig is
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service behaviorConfiguration="WCFSecurityService.Service1Behavior" name="WCFServiceCertificate.IService1"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" contract="WCFServiceCertificate.IService1"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WCFSecurityService.Service1Behavior"> <serviceCredentials> <clientCertificate> <authentication certificateValidationMode="PeerTrust"/> </clientCertificate> <serviceCertificate findValue="WCfServer" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> </serviceCredentials> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> <bindings> <wsHttpBinding> <binding name="wsHttpEndpointBinding"> <security> <message clientCredentialType="Certificate" /> </security> </binding> </wsHttpBinding> </bindings> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
please help me if any one knows the exact problem,thanks
Regards
Gajendra R.BahakarTuesday, July 3, 2012 5:05 AM
Answers
-
User-742633084 posted
Hi gajendra,
As you mentioned that the WCF service report error when you try accessing the wsdl metadata document(in Visual Studio Add Service Reference dialog), then have you tried directly accessing the wsdl metadata page in web browser (such as IE) to see if it can show correctly or display the same error?
Also, since you've applied message security and some other settings, I'd recommend you first turn off the security (of the binding element) to see if the problem is related to security setting (like the fragment shown below):
<wsHttpBinding> <binding name="wsHttpEndpointBinding"> <security mode="None" > <message clientCredentialType="Certificate" /> </security> </binding> </wsHttpBinding>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, July 4, 2012 12:58 AM
All replies
-
User-661350001 posted
but i am getting some error while adding service referecemay i request you to please post the error in details so that it will be easy to pin point the problemTuesday, July 3, 2012 9:18 AM -
User-183374066 posted
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" contract="WCFServiceCertificate.IService1"/>Why address is blank?
Try adding with following pattern
http://localhost:8080/myservice/MEX/
Tuesday, July 3, 2012 9:46 AM -
User1086292807 posted
Hi Nasser, i tried this also but till error is getting please go through the following link in order to understand my problem URL http://www.codeproject.com/Articles/36732/WCF-FAQ-Part-3-10-security-related-FAQ
Tuesday, July 3, 2012 9:49 AM -
User-183374066 posted
I go throught the article.The address is given in end points but your is blank.. Why?
The address shouldn't be blank in endpoint.
Please go through your code. You missed some thing.
Thanks and best luck.
Tuesday, July 3, 2012 10:16 AM -
User-742633084 posted
Hi gajendra,
As you mentioned that the WCF service report error when you try accessing the wsdl metadata document(in Visual Studio Add Service Reference dialog), then have you tried directly accessing the wsdl metadata page in web browser (such as IE) to see if it can show correctly or display the same error?
Also, since you've applied message security and some other settings, I'd recommend you first turn off the security (of the binding element) to see if the problem is related to security setting (like the fragment shown below):
<wsHttpBinding> <binding name="wsHttpEndpointBinding"> <security mode="None" > <message clientCredentialType="Certificate" /> </security> </binding> </wsHttpBinding>
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, July 4, 2012 12:58 AM -
User337895707 posted
Hi,
I get below error while i directly access wsdl metadata page in web browser.
XML Parsing Error: not well-formed
Location: file:///D:/Calculation/Calculation/Service1.svc
Line Number 1, Column 2:<%@ ServiceHost Language="C#" Debug="true" Service="Calculation.Service1" CodeBehind="Service1.svc.cs" %>
-^Please advise to rectify this error
Monday, December 9, 2013 10:09 AM