There is not much details that is being displayed in Error, so it is very hard to detect error.
The web.config that comes with sample, has only following section added to it.
<!-- WCF configuration -->
<system.serviceModel>
<standardEndpoints>
<webHttpEndpoint>
<!-- Use this element to configure the endpoint -->
<standardEndpoint name="http://localhost/ServiceModelSamples/service.svc" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
Any suggestions on how to resolve this error.
I also tried using the wcf test client utility that comes within visual studio.
It gives following error.
Error:
Cannot obtain Metadata from
http://localhost/ServiceModelSamples/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.
The webHttpEndpoint is used when writing a REST service. If you call
http://localhost/ServiceModelSample/service.svc with GET (as you do when browsing to the URL in a browser) you need to have a method marked with the [WebGet(UriTemplate("")] in your service contract to be able to get anything back.
If you declare the following method in your service:
[WebGet(UriTemplate="")]
MathResult Test();
....the Test() method will be called and invoked when you are browsing to your service at
http://localhost/ServiceModelSample/service.svc. If you look in the XmlAjaxClientPage.htm sample file, you'll se how POST requests to the service are made. The service methods to be invoked by POST
request are marked with the [WebInvoke] attribute.
Please 'Mark as Answer' if this post helped you.
Marked as answer by bhavin2002patel on Mar 25, 2012 07:54 PM
By default the code that comes with sample has following section in web.config.
Under name= "" it assumes local host or you have to specify IP address.
For some reason when it was blank it never worked, so I started checking service from browser and I started looking in wrong direction.
After you specified, I thought let me once again check with XmlAjaxClientPage.htm rather then verifying service is working or not.
I added my IP address instead of name="" in web.config and now when I run XmlAjaxClientPage.htm it works.
<configuration>
<!-- WCF configuration -->
<system.serviceModel>
<standardEndpoints>
<webHttpEndpoint>
<!-- Use this element to configure the endpoint -->
<standardEndpoint name=""/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
If you're also using IIS server on local machine(IIS 7?), then make sure you've specified the .NET framework version as 4.0 (latest) for the web site or virtual directory's application pool:
bhavin2002pa...
Member
7 Points
4 Posts
No Endpoint error while running WCF sample
Mar 25, 2012 01:52 AM|LINK
Hello,
I am trying to run the sample of WCF service provided by Microsoft.
Following is the sample that I am trying to run.
WF_WCF_Samples\WCF\Basic\A
I also followed all pre-steps that are needed to be configured.
However when I try to run service at URL, I get following error.
http://localhost/ServiceMo
Error says.
"Endpoint not found."
There is not much details that is being displayed in Error, so it is very hard to detect error.
The web.config that comes with sample, has only following section added to it.
<!-- WCF configuration -->
<system.serviceModel>
<standardEndpoints>
<webHttpEndpoint>
<!-- Use this element to configure the endpoint -->
<standardEndpoint name="http://localhost/ServiceMo
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
Any suggestions on how to resolve this error.
I also tried using the wcf test client utility that comes within visual studio.
delSamples/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.
link/?LinkId=65455.WS-Metadata Exchange Error
delSamples/service.svc Metadata contains a reference that cannot be resolved: 'http://localhost/ServiceModelSamples/service.svc' .
delSamples/service.svc that could accept the message.
delSamples/service.svc There was an error downloading 'http://localhost/ServiceModelSamples/service.svc' .
It gives following error.
Error:
Cannot obtain Metadata from http://localhost/ServiceMo
For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fw
URI: http://localhost/ServiceMo
There was no endpoint listening at http://localhost/ServiceMo
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found.HTTP GET Error URI: http://localhost/ServiceMo
The request failed with HTTP status 404: Not Found.
Thanks,
Bhavin
endpoint webservice WCF
mm10
Contributor
6395 Points
1182 Posts
Re: No Endpoint error while running WCF sample
Mar 25, 2012 05:24 PM|LINK
The webHttpEndpoint is used when writing a REST service. If you call http://localhost/ServiceModelSample/service.svc with GET (as you do when browsing to the URL in a browser) you need to have a method marked with the [WebGet(UriTemplate("")] in your service contract to be able to get anything back.
If you declare the following method in your service:
[WebGet(UriTemplate="")]
MathResult Test();
....the Test() method will be called and invoked when you are browsing to your service at http://localhost/ServiceModelSample/service.svc. If you look in the XmlAjaxClientPage.htm sample file, you'll se how POST requests to the service are made. The service methods to be invoked by POST request are marked with the [WebInvoke] attribute.
bhavin2002pa...
Member
7 Points
4 Posts
Re: No Endpoint error while running WCF sample
Mar 25, 2012 07:56 PM|LINK
mm10, you pointed me in right direction.
By default the code that comes with sample has following section in web.config.
Under name= "" it assumes local host or you have to specify IP address.
For some reason when it was blank it never worked, so I started checking service from browser and I started looking in wrong direction.
After you specified, I thought let me once again check with XmlAjaxClientPage.htm rather then verifying service is working or not.
I added my IP address instead of name="" in web.config and now when I run XmlAjaxClientPage.htm it works.
<configuration>
<!-- WCF configuration -->
<system.serviceModel>
<standardEndpoints>
<webHttpEndpoint>
<!-- Use this element to configure the endpoint -->
<standardEndpoint name=""/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
Thanks,
Bhavin
bhavin2002pa...
Member
7 Points
4 Posts
Re: No Endpoint error while running WCF sample
Mar 26, 2012 01:12 AM|LINK
One more problem.
Same code works on server, but not on my local development machine.
Is there any WCF installation to be done?
Bhavin
mm10
Contributor
6395 Points
1182 Posts
Re: No Endpoint error while running WCF sample
Mar 26, 2012 10:28 AM|LINK
You probably need to register WCF with IIS. Run ServiceModelReg.exe from a VS command prompt.
bhavin2002pa...
Member
7 Points
4 Posts
Re: No Endpoint error while running WCF sample
Mar 26, 2012 02:29 PM|LINK
I executed ServiceModelRe -ia which would install all components. It says HTTP namespace reservation already exists.
So it seems that WCF components are already installed.
Bhavin
Steven Cheng...
Contributor
4187 Points
547 Posts
Microsoft
Moderator
Re: No Endpoint error while running WCF sample
Mar 27, 2012 03:06 AM|LINK
Hi Bhavin,
If you're also using IIS server on local machine(IIS 7?), then make sure you've specified the .NET framework version as 4.0 (latest) for the web site or virtual directory's application pool:
#Specify a .NET Framework Version for an Application Pool (IIS 7)
http://technet.microsoft.com/en-us/library/cc754523(v=WS.10).aspx
BTW, for creating WCF REST service, you can try using the WCF REST service project template for Visual Studio:
#WCF REST Service Template 40(CS)
http://visualstudiogallery.msdn.microsoft.com/fbc7e5c1-a0d2-41bd-9d7b-e54c845394cd
Feedback to us
Microsoft One Code Framework