Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET4.0
There was no endpoint listening at http://localhost:7783/GetDataService.svc/JSONData that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Posted 9-May-13 19:18pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi Ganesh,
 
I got same issue at clint apllication. But it worked when i change property in service interface like below:

[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare)]
  Permalink  
v2
Comments
Ganeshh2 at 11-May-13 5:53am
   
Hi Vijay,
 
Thank u very much..
u r posted exact solution to my issue. my problem was solved with ur solution.
Mohammed Hameed at 11-May-13 6:03am
   
Congrats Ganesh & Thanks Vijay...
 
Sorry, unfortunately my solution didn't work. Anyhow good that I have also learnt something. Thanks...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi Ganesh,
 
Check the service url (Check the url by opening it in any browser like Internet explorer.): http://localhost:7783/GetDataService.svc/JSONData[^] whether it is running or not.
 
If not, then you have to right click on the SVC file and select open in web browser option.
 
This could resolve the issue. But if you still face the issue please let me know.
  Permalink  
v2
Comments
Ganeshh2 at 10-May-13 1:21am
   
Hi Mohammed,
 
my WCF service address is "http://localhost:7783/GetDataService.svc" it is working. But when iam trying to call the service method "JSONData()" from my web application it gives the above exception "http://localhost:7783/GetDataService.svc/JSONData". what i need to do?
Mohammed Hameed at 10-May-13 1:31am
   
Okay, good that service is running fine. Could you double check the endpoints in the config file.
Also, use WCFTestClient.exe to test whether the method JSONData() is running fine or not. It is located somewhere here: "C:\Program Files\Microsoft Visual Studio 10.0\Common7\
Ganeshh2 at 10-May-13 2:02am
   
Yes, its running in WCFTestClient.exe. now it's showing exception like this "The remote server returned an unexpected response: (405) Method Not Allowed." in my web application.
Mohammed Hameed at 10-May-13 2:20am
   
Hmmm. Then probably there is an issue with the method JSONData() itself. So, put a breakpoint in the method and run the application by attaching your service app to it (or by running service in wcfTestClient) for debugging purpose. By this, you can trace whats wrong going on in the method. This should probably get you the real problem and hence you can resolve as well.
 
Do update me for any queries...
Ganeshh2 at 10-May-13 4:02am
   
JSONDATA() method is running perfectly in WCFTestClient.exe tool, but my problem is when that method is calling from my web application it gives this exceptiom "The remote server returned an unexpected response: (405) Method Not Allowed." in my web application".
Mohammed Hameed at 10-May-13 4:38am
   
Make sure that the service endpoint & bindings configurations are correct in config file.
Or better to delete your service agent and recreate it so that if any issue in old proxies then it goes off. And new proxies would be created by wcf.
Check this link as well: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/7c9c7c8d-cf02-42a2-aca3-ba2749f5af4e it might give you some other hint also.
 
Ganesh, do let me know if you required more help.
Ganeshh2 at 10-May-13 5:14am
   
I have done as said by you but the problem didn't solved.. again it shows above exception.
Mohammed Hameed at 10-May-13 5:37am
   
Any other service methods are working or giving the same error?
Ganeshh2 at 10-May-13 5:40am
   
yes, for other service methods also it shows same exception.
Mohammed Hameed at 10-May-13 5:40am
   
Can u send me the error screenshot if possible?
Mohammed Hameed at 10-May-13 5:43am
   
Are you missed using contracts attributes such as [OperationContract] on top of the interface methods?
Ganeshh2 at 10-May-13 5:49am
   
no that is not missing. i also used webinvoke attribute for json response.
Mohammed Hameed at 10-May-13 5:54am
   
Is your service is running thru IIS or thru visual studio?
Can u plz send me the error screenshot and full exception details to get clear picture as to trace what is going on?
Ganeshh2 at 10-May-13 6:01am
   
Exception message:ProtocolException was unhandled by user code
The remote server returned an unexpected response: (405) Method Not Allowed.
--------------------------------------------------
my code is :
 
Interface in WCF service is :
 
public interface IGetDataService
{
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
string XMLData(string id);
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
string JSONData();
 
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/xml")]
List GetTopicsNames();
}
 
[DataContract]
public class TopicsNames
{
string qbmaintopics = string.Empty;
 
[DataMember]
public string QBMaintopics
{
get { return qbmaintopics; }
set { qbmaintopics = value; }
}
 
}
------------------------------------------------------
web application code in which i consume WCF service is :
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExampleService;
using System.Net;
using System.IO;
using System.Runtime.Serialization.Json;
 
public partial class _Default : System.Web.UI.Page
{
GetDataServiceClient objService = null;
 
protected void Page_Load(object sender, EventArgs e)
{
objService = new GetDataServiceClient();
}

protected void btnGetMaintopics_Click(object sender, EventArgs e)
{
string str = objService.JSONData();
lbldata.Text = str;
}
}
Ganeshh2 at 10-May-13 6:04am
   
My service is running through visualstudio..
Ganeshh2 at 10-May-13 6:49am
   
Mohammed, if you find any solution? please let me know.... !
Mohammed Hameed at 10-May-13 6:51am
   
The same thing is working perfectly in my system.
Then I think it is port related issue. May be the other ports like 7783 are blocked from windows firewall. So what you can do is check if you can allow that port thru firewall and also give a static port to your service by going to Serivce project properties-->Select Web tab -->Under Servers select the option specific port and then enter the port there.
 
Plz update me if any more info needed...
Ganeshh2 at 10-May-13 7:01am
   
can u suggest any port no n one more thing in my system IIS is not installed
Mohammed Hameed at 10-May-13 7:09am
   
You can use any port like 15000 but make sure that the port is allowed thru your firewall.
 
But if this also dont work then just try port 8080 (actually its a default port assigned for default website but anyhow as u said u dont have IIS feature enabled, you can give it a try).
 
IIS is not required if you are running service thru VS (VS uses built-in cassini webserver).
Ganeshh2 at 10-May-13 7:14am
   
how can we know whether the port number is allowed by firewall or not?
Mohammed Hameed at 10-May-13 7:19am
   
go to control panel-->type firewall in the upper corner Search textbox-->Windows firewall will appear-->Here click on 'Allow a program through windows firewall'-->there you can add the port to allow.
OR if this also wont work in case then Turn off the firewall temporarily and then run your service and application.
Ganeshh2 at 10-May-13 7:25am
   
Thank u very much Mohammed for showing interest to solve my issue...
 
can you send me "web.config" files code of both WCF service and web applications.
Mohammed Hameed at 10-May-13 7:26am
   
Thanks for Vote, Ganesh!
Mohammed Hameed at 10-May-13 7:27am
   
Can u accept my Solution 1 also?
Ganeshh2 at 10-May-13 7:33am
   
Please send me "web.config" files codes.
Mohammed Hameed at 10-May-13 7:38am
   
Service web.config:
 


 







<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->

<!-- 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 -->











Mohammed Hameed at 10-May-13 7:40am
   
Tags are automatically being deleted if I post as Comment.
 
Okay I will post it as Solution then.
Mohammed Hameed at 10-May-13 7:35am
   
Thanks a lot Ganesh for accepting my Solution.
 
BTW is issue resolved or not?
Ganeshh2 at 10-May-13 7:40am
   
Everything of my code is correct but i think ndue to network problem only i got that exception, but u gave good explanation for network problem. but my issue is didnt resolved yet thats y iam asking web.config files code.
Mohammed Hameed at 10-May-13 7:45am
   
Plz check Solution 2 I have posted config files.
 
Did u set the port and allowed it thru firewall or atleast turned off ur firewall?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Service config file:
<?xml version="1.0"?>
<configuration>
 
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
 
</configuration>
 

App Config file:
 
<pre>
<configuration>
  
    <system.servicemodel>
        <bindings>
            <basichttpbinding>
                <binding name="BasicHttpBinding_IMainService" closetimeout="00:01:00">
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
            </basichttpbinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:1298/MainService.svc" binding="basicHttpBinding">
                bindingConfiguration="BasicHttpBinding_IMainService" contract="MainServiceAgent.IMainService"
                name="BasicHttpBinding_IMainService" />
        </endpoint></client>
    </system.servicemodel>
</configuration>
  Permalink  
Comments
Ganeshh2 at 10-May-13 7:47am
   
good mohammed, but by using basicHttpBinding i got the out put but we didnot get "Json" format data right. for Json data "webHttpbinding" must be use right. for webHttpBinding" i got that exception. please give explanation.
Mohammed Hameed at 10-May-13 7:51am
   
Hmmm. Okay atleast by now we got to know the real issue. Thats great... Anyhow I dont know much about using Json (as I have used it very long ago). But I would suggest u to read this short article on it: "http://www.codeproject.com/Articles/327420/WCF-REST-Service-with-JSON" I hope it would give u an idea to fix ur problem.
Ganeshh2 at 10-May-13 7:59am
   
Thank you very much mohammed i will go through that link.
Mohammed Hameed at 10-May-13 8:00am
   
You're welcome :)
Mohammed Hameed at 10-May-13 9:45am
   
Any luck Ganesh?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 259
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 187
4 Sinisa Hajnal 176
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 10 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100