locked
Could not find default endpoint element that references contract IService1 in the ServiceModel client configuration section RRS feed

  • Question

  • Hi,

    I am getting the above error. When I try to generate the proxy using svcutil, I get an error  as:

    "There was an error importing a wsdl:binding that the wsdl:port is dependent on"..

    But the proxy .cs file is generated.

    The host is running perfectly and I can view the wsdl.

    Can someone help me out with this ?

    Also is there any example available somewhere that I can use. I tried using MSDN Virtual lab example but I am getting the same error with it too.

     

    Thanks,

    Akhil Jindal

    Thursday, June 22, 2006 12:20 PM

Answers

  • Not sure if this will help you, but here is how I resolved it.

    When I was working on another sample myself, it was coded against May CTP and I was working with June CTP.

    The first thing I had to do was add the mex endpoint into the service's .config file. Then I could run the service from the browser (http://localhost:8000/MediaServices). It gave me its local config page that replaces the old soap page from the .aspx days. It displays the commad line to run svcutil (svcutil.exe http://localhost:8000/MediaServices?wsdl).

    I ran svcutil from the Windows SDK 6.0 menu. It generated a new proxy .cs file and a client config file. I moved that code over into my sample client. When I ran my client code I got a similar error message as the original poster. What I did to fix it was within the endpoint in my client config file. I put the change in bold below. Svcutil just put ImagingServicesContractSoap but at runtime it was looking for a fully qualified contract name. I could not find the fully qualified name in the client code so I assumed this fully qualified name was coming from the WCF framework. There could be a better way but it works for now and since this is not the RTM I am not worried.

        <client>
          <endpoint address="http://localhost:8000/MediaServices/ImagingService"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ImagingServicesContractSoap"
            contract="ImagingClient.localhost.ImagingServicesContractSoap" name="WSHttpBinding_ImagingServicesContractSoap">
            <identity>
              <certificate encodedValue="encoded string" />
            </identity>
          </endpoint>
        </client>

    Friday, July 14, 2006 3:34 PM
  • Aha!  This (reading MyApp.config rather than MyApp.exe.config) is a known bug in 2k3 server with UAC manifests:

    http://blogs.msdn.com/junfeng/archive/2006/08/09/692996.aspx

    Thursday, May 24, 2007 10:47 PM

All replies

  • Hello,

    Could you please post the entire svcutil error message? 

    Also, if you could please post the WSDL for the service I can try to reproduce the issue.

    Thanks.

    Daniel Roth

    • Proposed as answer by JohnAbraham Monday, February 23, 2009 10:55 AM
    Monday, June 26, 2006 10:46 PM
  • Hi all,

    I also got the same error message when i was trying to run my client.
    But in my case, I could generate the proxy successfully using svcutil. I didnt get any error message.
    And when I built it, it worked fine.
    The client's config itself was also generated by the svcutil.

    Can anybody help me, where my mistake is?

    Regards,
    lingga

    Thursday, June 29, 2006 10:54 AM
  • can you please send me your repro code,I will try to repro here,my email id is madhup@microsoft.com

    -Thank you

    Madhu

    Thursday, June 29, 2006 1:52 PM
  • I too got the same error. The client proxy and the config file were created successfully.

     

     

    Tuesday, July 11, 2006 6:09 AM
  • If possible,can you please send me repro,my email id is madhup@microsoft.com

    Are you using beta 2 or June CTP?

    can you please send me operating system details also

     

    -Thank you

    Madhu

     

    Tuesday, July 11, 2006 5:32 PM
  • Not sure if this will help you, but here is how I resolved it.

    When I was working on another sample myself, it was coded against May CTP and I was working with June CTP.

    The first thing I had to do was add the mex endpoint into the service's .config file. Then I could run the service from the browser (http://localhost:8000/MediaServices). It gave me its local config page that replaces the old soap page from the .aspx days. It displays the commad line to run svcutil (svcutil.exe http://localhost:8000/MediaServices?wsdl).

    I ran svcutil from the Windows SDK 6.0 menu. It generated a new proxy .cs file and a client config file. I moved that code over into my sample client. When I ran my client code I got a similar error message as the original poster. What I did to fix it was within the endpoint in my client config file. I put the change in bold below. Svcutil just put ImagingServicesContractSoap but at runtime it was looking for a fully qualified contract name. I could not find the fully qualified name in the client code so I assumed this fully qualified name was coming from the WCF framework. There could be a better way but it works for now and since this is not the RTM I am not worried.

        <client>
          <endpoint address="http://localhost:8000/MediaServices/ImagingService"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ImagingServicesContractSoap"
            contract="ImagingClient.localhost.ImagingServicesContractSoap" name="WSHttpBinding_ImagingServicesContractSoap">
            <identity>
              <certificate encodedValue="encoded string" />
            </identity>
          </endpoint>
        </client>

    Friday, July 14, 2006 3:34 PM
  • Has anyone heard of receiving this error on Windows Server 2003 only?  I have a manual client endpoint defined in a manual app.config file.  The service client behaves correctly on any XP or Vista machine, but throws this error ONLY on a Windows Server 2003 machine.  Any ideas?
    Wednesday, April 25, 2007 3:02 PM
  • After much more research, I have found that my issue does not pertain directly to WCF.  For some reason, my application configuration file, normally named [Application].exe.config, must be named [Application].config on Windows Server 2003 in order for ANY configuration sections to be read (including system.ServiceModel for WCF).

     

    Does anyone know of any reason why this is so?  I have been searching for days and it seems no one is having this issue.

    Thursday, April 26, 2007 5:50 PM
  • It is hard to believe that no one else has ever come across this issue.  The documentation for the ConfigurationManager class states that it is supported on Windows Server 2003. No one has a clue?
    Friday, April 27, 2007 2:32 PM
  • I use 2k3 server all the time, and app.exe.config works for me.

    Are you sure it's not the case that, for example, you app is not named app.exe, and instead is named just 'app' maybe?

    Friday, April 27, 2007 2:37 PM
  • The application executable is ReportingDashboard.exe and the config file is ReportingDashboard.exe.config.

     

    This works 100% of the time on XP and Vista, just not on Server 2003.  Whenever I rename the config file to ReportingDashboard.config, Server 2003 picks it up, but XP and Vista break.

     

    I'm assuming you were referring to the executable name when you mentioned "app" in your post.

    Friday, April 27, 2007 3:01 PM
  • Aha!  This (reading MyApp.config rather than MyApp.exe.config) is a known bug in 2k3 server with UAC manifests:

    http://blogs.msdn.com/junfeng/archive/2006/08/09/692996.aspx

    Thursday, May 24, 2007 10:47 PM
  • I am developing a user control that is using wcf services in design time. i got this error when using the service in my custom uitypeeditor.

    but when i used it in runtime, i didn't get the error.

     

    My OS is windows server 2003 sp1.

     

    tnx.

     

    Saturday, June 9, 2007 7:10 AM
  • I got the same error. But the problem i made is that i had my proxy inside the namespace, whilst on the app.config i referenced it as "IMyContract", instead of "MyNamespace.IMyContract". You may call "MyNamespace.IMyContract", or else, remove the namespace on the proxy , hope that will work
    Monday, January 7, 2008 8:48 AM
  • Just an FYI.  I was getting the same error, but on a WPF application. When adding an application configuration file in WPF it named it App1.config.  I deleted the configuration file an added a new one with App.config and it worked.

    Thursday, May 1, 2008 7:53 PM
  •  

    I got the same error while running the client application, and did the following to solve it.

     

    Error: "Could not find default endpoint element that references contract 'ISomeService' 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."

     

    Solution: Just change the name of "output.config" file (generated by svcutil.exe) to "app.config". It worked for me fine.

     

    • Proposed as answer by GrizNasty Wednesday, December 9, 2009 9:12 PM
    Friday, June 6, 2008 10:42 AM
  •  

    I got the same error while running the client application, and did the following to solve it.

     

    Error: "Could not find default endpoint element that references contract 'ISomeService' 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."

     

    Solution: Just change the name of "output.config" file (generated by svcutil.exe) to "app.config". It worked for me fine.

    Friday, June 6, 2008 10:44 AM
  •  

    The best solution is to do sth else instead of using svcutil.exe.

    what u do is to add a service refrence to your project and automaticaly app.config is confgiured.then u can call the class and it is done.

     

     

    Tuesday, September 16, 2008 6:57 AM
  • Yes - it's true! I can confirm this issue on Windows Server 2003 R2 Enterprise Edition.

    I 've renamed my [Application].exe.config to
    [Application].config and my WebService is working now !

    You saved my day - you are a true hero! THANK YOU!
    • Proposed as answer by signitin Friday, October 23, 2009 10:38 AM
    Saturday, September 20, 2008 10:39 PM
  • We ran into the same bug (rename <app>.exe.config to <app>.config fixes it) on some customer's Windows Server 2003 R2 systems. Thanks for the info, saved our bacon! We have anecdotal reports that some Windows 2003 R2 Servers work fine; we are not sure what is different.

    Does anyone know if there is a fix for it on Microsoft Update? Or if/which KB article covers this? I can only come up with the blog post mentioned above trying a web search.
    Monday, December 1, 2008 9:21 PM
  • I got "could not find default endpoint element that references contract ..." error for the following scenario:
    I generated proxy using svcutil.exe and specified name space using /n (/n:*.MyNameSpace). But I just had my service contract in web.config in contract attribute.

     I changed contract attribute in web.config to include proxy name space(highlighted in red background), and error disappeared.

     <system.serviceModel>
      <bindings>
       <netTcpBinding>
        <binding name="NetTcpBinding_IProposalService" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                        hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                        maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                        maxReceivedMessageSize="65536">
         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <reliableSession ordered="true" inactivityTimeout="00:10:00"
                            enabled="false" />
         <security mode="Transport">
          <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
          <message clientCredentialType="Windows" />
         </security>
        </binding>
       </netTcpBinding>
      </bindings>
      <client>
       <endpoint address="net.tcp://localhost:10010/ProposalWCFService"
                    binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IProposalService"
                    contract="MyNameSpace.IProposalService" name="NetTcpBinding_IProposalService">
        <identity>
         <userPrincipalName value="domainusername" />
        </identity>
       </endpoint>
      </client>
     </system.serviceModel>

     


    GR
    Tuesday, January 27, 2009 10:32 PM
  • I have the same problem, but the best and easiest solution is:

    go in your visual studio project and copy your app.config file in your main application folder.

    Sample:

    I have a projectmap "xyz" with:
    • c# winform application "studio"
    • c# class library "myWebService", they contains the webservice reference
    When you refresh your web reference, a app.config file was created in your class library "myWebService" automatically.
    Ok, now when your try to call the web service functionality from your "studio" application, you get the error "Could not find default endpoint element that referencres contract...".
    Now copy your app.config from your "myWebService" class library to your "studio" application.

    It running without problems.
    • Proposed as answer by NozzNazz Tuesday, November 3, 2009 10:22 AM
    Tuesday, November 3, 2009 10:22 AM
  • Hi All,

     

    I was running a wcf sample today and i came across this issue of not finding endpoint,alternatively i can resolve this by adding through Add Service references

    Would be interested to know the difference between app.config usage and servicereference usage

    please suggest

     

    Thanks

     

     

    Monday, March 22, 2010 5:03 AM
  • Check if you have reference to system.runtime.serialization and system.serviceModel. Adding those libraries helped in my case.
    Wednesday, June 16, 2010 3:15 PM
  • Hi All,

    I made a custom webservice using VS2010 C# deployed on SharePoint Server 2010. I could run the service from the browser (http://localhost/...). It gave me its local config page. It displays the commad line to run svcutil (svcutil.exe http://localhost/...?wsdl). Since I want to test the webservice, I follow also the instructions to write sample client as test (using C#).

    I ran svcutil from cmd.exe. It generated a new proxy .cs file and a client config file (output.config). I moved that code over into my sample client and added to the sample client project using "Add existing item". When I ran my client code I got a similar error message "Could not find default endpoint element that references contract I.... in the ServiceModel client configuration section".

    I have also added Service Reference and it generated automatically app.config. The content of app.config is same as output.config.
    The reference to system.runtime.serialization and system.serviceModel exist in both Webservice project and sample client project. But still have the problem.

    Can anyone tell me how to resolve this problem? Thank you in advance
    P.S. : I am working on VMServer running on Windows Server 2008 R2

    Friday, September 24, 2010 7:15 AM
  • I am trying to access a webservice from a C# ClassLibrary which is called from a ATL DLL and this ATL dll is used by a MFC application. I am getting similar error while accesing the webservice. I know the solution to provide the endpoint in app.config. For testing purpose I created C# console app (Define the endpoint) and accessed the C# Class Library, it works. But i am not able to figure out how to include the app.config in ATL DLL.
    Sandeep Gupta
    Thursday, July 14, 2011 11:00 AM