none
consume web service in Asp.net MVC RRS feed

  • Question

  • I have a problem when calling web Services in ASP.net MVC , I do the following

    add the web service by add service reference to solution, and I include the service.cs file to the solution also, but when I try to create object in home controller , I have the following error

    Could not find default endpoint element that references contract 'Service' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

    can any one help me please

    thanks

    Tuesday, April 23, 2013 2:38 AM

Answers

  • Hi Rana_Husni,

    Since you're using "add servicereference" to generate the client proxy (WCF specific) for consuming webservice, you can check the following things to ensure that the proxy is correctly generated:

    1) In the visual Studio solution explorer, choose "Show All Files" to display all files in explorer. Try finding the generated service reference (client proxy) files under the "Service References" folder. Open the Reference.cs file which should contain the auto-generated client-proxy code. If there is no code generated there, there might has something wrong with the proxy generation

    2) After proxy is generated, there will has some endpoint and binding configuration information added in the web.config file (withing <system.serviceModel> secion). You can also verify this in your ASP.NET MVC web application's web.config file.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 30, 2013 3:02 AM
    Moderator

All replies

  • I believe you are looking for this forum instead: http://social.msdn.microsoft.com/Forums/en-US/wcf/threads

    -Ian

    Monday, April 29, 2013 4:01 PM
  • Hi Rana_Husni,

    Since you're using "add servicereference" to generate the client proxy (WCF specific) for consuming webservice, you can check the following things to ensure that the proxy is correctly generated:

    1) In the visual Studio solution explorer, choose "Show All Files" to display all files in explorer. Try finding the generated service reference (client proxy) files under the "Service References" folder. Open the Reference.cs file which should contain the auto-generated client-proxy code. If there is no code generated there, there might has something wrong with the proxy generation

    2) After proxy is generated, there will has some endpoint and binding configuration information added in the web.config file (withing <system.serviceModel> secion). You can also verify this in your ASP.NET MVC web application's web.config file.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 30, 2013 3:02 AM
    Moderator