none
problem generating proxy and configuration files with svcutil.exe -- for my wcf sample project (win 7 pro vs2012 pro) -- how to resolve the problem? RRS feed

  • Question

  • I am working on a basic helloWorld WCF app with endpoints, http binding, ...  I created a .svc file -- I can view it in IE (11), and I see this:

    so I go to the command prompt and enter (paste) the following after changing to the proper directory

    when I hit "Enter" on the keyboard I get the following information

    Why am I getting this error?  How do I resolve this error?


    Rich P



    • Edited by Rich P123 Thursday, July 16, 2015 10:56 PM ......
    Thursday, July 16, 2015 10:55 PM

Answers

All replies

  • Hi Rich P123,

    When running Svcutil.exe to get metadata for a service that exposes two different service contracts that each contain an operation of the same name, Svcutil.exe displays an error saying, “Cannot obtain Metadata from ....” For example, if you have a service that exposes a service contract called ICarService that has an operation Get(Car c) and the same service exposes a service contract called IBookService that has an operation Get(Book b). To work around this issue, do one of the following:
    •Rename one of the operations
    •Set the Name to a different name.
    •Set one of the operations' namespaces to a different namespace using the Namespace property.

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj


    Friday, July 17, 2015 3:17 AM
    Moderator
  • Thank you for your reply and suggestion.  My service is a bare bones service -- only has one method

    namespace MyWCFServices
    {
        public class HelloWorldService : IHelloWorldService
        {
            public String GetMessage(String name)
            {
                return "Hello world from " + name + "!";
            }
        }
    }

    One thing I did read is that there are different versions of svcutil.exe -- one for .net 3.0 and one for .net 4.0.  I used the one for .net 3.0.  So I changed the directory to the .Net 4.0 svcutil.exe.  At least now I am getting a slightly different error message -- that access is denied to the path for HelloWorldServiceRef.cs -- as per the following image:

    I'm kinda getting there.  How to fix this problem?


    Rich P

    Friday, July 17, 2015 4:37 AM
  • Hi Rich P123,

    According to this issue,may be you can try it like below:

    svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service

    For more information,please refer to the following article:

    1.How to: Create a Windows Communication Foundation Client

    https://msdn.microsoft.com/en-us/library/ms733133(v=vs.90).aspx

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj

    Friday, July 17, 2015 5:25 AM
    Moderator