?
Solved

Error while running svcutil.exe

Posted on 2007-10-09
10
Medium Priority
?
3,432 Views
Last Modified: 2013-12-17
I am getting the following error while running the svcutil.exe. Infact the service is running with NetTcpBinding.

C:\Jacob\WCF\Client\Client\Client>svcutil.exe /language:cs /config:app.config ne
t.tcp://localhost:8000/ServiceModelSamples/service
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'net.tcp://localhost:8000/ServiceModelSampl
es/service' using WS-Metadata Exchange. This URL does not support DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from net.tcp://localhost:8000/ServiceModelSamples/
service

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: net.tcp://localhost:8000/ServiceModelSamples/service

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:
8000/ServiceModelSamples/service'.

    There was no endpoint listening at net.tcp://localhost:8000/ServiceModelSamp
les/service that could accept the message. This is often caused by an incorrect
address or SOAP action. See InnerException, if present, for more details.

If you would like more help, type "svcutil /?"
**********************************

Here is the code i wrote in Host application

    class Program
    {
        static void Main(string[] args)
        {
            Uri baseAddress = new Uri("net.tcp://localhost:8000/ServiceModelSamples/Service");
            ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);
            try
            {
                // Add a service endpoint
                serviceHost.AddServiceEndpoint((typeof(ICalculator)) ,new  NetTcpBinding ()   ,  "CalculatorService");
                // Enable metadata exchange
                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                //smb.HttpGetUrl = new Uri("http://localhost:8000/ServiceModelSamples/Service"); ;
                serviceHost.Description.Behaviors.Add(smb);
                serviceHost.Open();
                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();

                // Close the ServiceHostBase to shutdown the service.
                serviceHost.Close();
            }
            catch (CommunicationException ce)
            {
                Console.WriteLine("An exception occured: {0}", ce.Message);
                serviceHost.Abort();
            }
        }
    }

Can you tell me where i am going wrong?
0
Comment
Question by:x1877
  • 5
  • 4
10 Comments
 
LVL 21

Accepted Solution

by:
surajguptha earned 2000 total points
ID: 20042741
svcutil.exe /language:cs /config:app.config ne
t.tcp://localhost:8000/ServiceModelSamples/service

Metadata is not TCP . It should always have a HTTP address. You might be trying to generate the proxy using the actual service end point and not the mex end point.

If you want to generate WSDL a explicit end point should be added to your service end points list to expose WSDL.
0
 

Author Comment

by:x1877
ID: 20042817
I am a beginer in the subject. I have tried the wcf samples from msdn. Now i am just trying to change the binding to NetTcpBinding from WSHttpBindingBase. What all i need to change if i change the binding from  WSHttpBindingBase to NetTcpBinding ?
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 2000 total points
ID: 20042944
If you are following the samples and looking to learn, i would suggest you follow the samples line by line. Thats how i learnt it and it really helps. But if you are looking to change the binding, i would suggest instead of creating the end points using the code, you could create the end points using config file.

When you create a new service, you could either do it using code or using config file. Config file is so much easier.

With regards to your question there isnt anything different when using WSHTTP except you use a http address instead of net.tcp and code a WS end point instead of TCP
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:x1877
ID: 20043054
Thats going to be my next try, i mean keeping the binding info in config file.

Regarding my question,  I dont know why i am getting the error. i feel i need to change something on   "//Enable metadata exchange" part to generate the proxy using svcutil.exe
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 2000 total points
ID: 20043082
You get the error because the metadata or the mex binding is not present. You should add a new endpoint only for exposing the WSDL.
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20043088
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 2000 total points
ID: 20043117
Why is this line commented??

  //smb.HttpGetUrl = new Uri("http://localhost:8000/ServiceModelSamples/Service"); ;
0
 
LVL 22

Expert Comment

by:p_davis
ID: 20043184
as surajguptha has said you will need to add a new mexHttpbinding endpoint to expose this service for the svcutil to use.

the service will have to have the service behavior getHttpenabled

the easiest way , imho, is to download the sdk from microsoft and use the configruation editor
0
 

Author Comment

by:x1877
ID: 20043745
Thanks for all your support.
Finally got it running. I was making mistake at 2 places.
1.                 smb.HttpGetEnabled = true; This was not there
2.                 smb.HttpGetUrl = new Uri("http://localhost:8001/ServiceModelSamples/Service");
This one was using port 8000 like  smb.HttpGetUrl = new Uri("http://localhost:8000/ServiceModelSamples/Service");
which was already used by baseAddress on the top.



0
 

Author Comment

by:x1877
ID: 20043760
sorry p_davis: I could not try configruation editor
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question