WCF Errors using WCFTestClient to test a simple WCF Web Service
Asked Answered
L

5

13

When I try to test the AutoLotWCFService using "wcftestclient", I get the following error. What am I doing wrong? Any insight will help. This is a simple Web Service that has wshttpbinding with interface contract and the implementation in the service. Here is the long error message: The Web.Config file has 2 endpoints - one for Web Service itself and other for metaDataExchange. Its all pretty much default stuff. I can include the code if needed - it seems I cannot attach files here.


Error: Cannot obtain Metadata from http://localhost/AutoLotWCFService/Service.svc
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  
For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
    URI: http://localhost/AutoLotWCFService/Service.svc
    Metadata contains a reference that cannot be resolved: 'http://localhost/AutoLotWCFService/Service.svc'.
    The remote server returned an unexpected response: (405) Method not allowed.
    The remote server returned an error: (405) Method Not Allowed.
    HTTP GET Error    URI: http://localhost/AutoLotWCFService/Service.svc
    The document at the url http://localhost/AutoLotWCFService/Service.svc was not recognized as a known document type.The error message from each known type may help you fix the problem:
    - Report from 'DISCO Document' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 2).' -Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.
    - Report from 'XML Schema' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.

Liqueur answered 9/10, 2008 at 22:26 Comment(3)
Can you include the config sections relating to the service? Hard to tell without that what is going on.Epode
The sevice contract (and any data contracts that are used) would be helpful too.Rarely
Add this to your server web config under <behaviour> specified, will then provide the real error: <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>Reminiscent
G
15

I recently had this problem whilst trying to host WCF on my Windows Vista Laptop under IIS7.

I first recieved the following error : "HTTP Error 404.3 - Not Found" and one of the resolutions suggested was to "Ensure that the expected handler for the current page is mapped."

So I added a handler for the .svc file manually and defined it as a DiscoveryRequestHandler, thinking that this might help. This caused the problem you described above.

The actual resolution was to delete the handler I had added, and to run the following commands:

CD c:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
ServiceModelReg -i

This resolved my issue and the service is working fine. I hope this might help shed some light on your problem. I can't be certain but this is probably because of the order in which I've installed the various packages on my dev laptop.

Gainey answered 24/2, 2009 at 15:51 Comment(2)
Excelent! This worked like a charm. Had a 404.17 problem and this fixed it.Stackhouse
This also solved my "Method not allowed" error. The service would work on visual studio's builtin web server, but not on iis on localhost. Now it works with iis too.Snowflake
U
1

If installing compenonts doesnt work try a repair, this uninstalls and then installs.

"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
Urushiol answered 19/3, 2011 at 10:55 Comment(0)
D
0

you need to make sure that the service behaviour configuration enables has a metadata tag with httpGetEnabled="true"

<serviceBehaviors>
  <behavior name="serviceBehavior">
    <serviceMetadata httpGetEnabled="true">
  </behavior>
</serviceBehaviors>

In addition, make sure your service references that behavior.


<service name="blah" behaviorConfiguration="serviceBehavior">
Depute answered 9/10, 2008 at 22:34 Comment(0)
L
0

Thanks; believe it or not the problem of at least loading the service through wcftestclient was solved when I re-registered the ASPNET in IIS with aspnet-regiis.

The next problem is to be able to invoke the methods exposed by the service through wcftestclient. What are the security issues that I have to deal with? I had to enable Anonymous login with windows auth. and still the invoke generated exceptions that pointed to something related to access violation. On searching some things point to installing certificates to be able to invoke.. Please enlighten if possible.

Lucent answered 13/10, 2008 at 15:52 Comment(0)
L
0

Try checking if service(name) in the Service Markup (right click on servicename.svc) matches the service(name) in your web.config file.

Cheers!

Lissettelissi answered 15/6, 2010 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.