x1877
asked on
Error while running svcutil.exe
I am getting the following error while running the svcutil.exe. Infact the service is running with NetTcpBinding.
C:\Jacob\WCF\Client\Client \Client>sv cutil.exe /language:cs /config:app.config ne
t.tcp://localhost:8000/Ser viceModelS amples/ser vice
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/ ServiceMod elSampl
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/S erviceMode lSamples/
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/S erviceMode lSamples/s ervice
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:
8000/ServiceModelSamples/s ervice'.
There was no endpoint listening at net.tcp://localhost:8000/S erviceMode lSamp
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:8 000/Servic eModelSamp les/Servic e");
ServiceHost serviceHost = new ServiceHost(typeof(Calcula torService ), baseAddress);
try
{
// Add a service endpoint
serviceHost.AddServiceEndp oint((type of(ICalcul ator)) ,new NetTcpBinding () , "CalculatorService");
// Enable metadata exchange
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
//smb.HttpGetUrl = new Uri("http://localhost:8000/ServiceModelSamples/Service"); ;
serviceHost.Description.Be haviors.Ad d(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?
C:\Jacob\WCF\Client\Client
t.tcp://localhost:8000/Ser
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/
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/S
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/S
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:
8000/ServiceModelSamples/s
There was no endpoint listening at net.tcp://localhost:8000/S
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:8
ServiceHost serviceHost = new ServiceHost(typeof(Calcula
try
{
// Add a service endpoint
serviceHost.AddServiceEndp
// Enable metadata exchange
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
//smb.HttpGetUrl = new Uri("http://localhost:8000/ServiceModelSamples/Service"); ;
serviceHost.Description.Be
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
More clarity here -> http://blogs.msdn.com/drnick/archive/2006/08/22/Manually-Adding-MEX-Endpoints.aspx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
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.
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.
ASKER
sorry p_davis: I could not try configruation editor
ASKER