Generate proxy class

I try to generate a proxy class with the Svcutil tool.

I host my service in a windows console program.

// Host the service

publicstaticvoid Main()

{

// Create a ServiceHost.

using (ServiceHost serviseHost =newServiceHost(typeof(helloService)))

{

// Add an endpoint.

WSHttpBinding binding =newWSHttpBinding();

Uri uri =newUri("http://localhost:8000/hello1/");

serviseHost.AddServiceEndpoint(typeof(IHello), binding, uri);

// Open the service.

serviseHost.Open();

// The service can now be accessed.

// Hold it open untill user presses ENTER.

Console.WriteLine("The service is ready");

Console.WriteLine();

Console.WriteLine("Press ENTER to shut down service.");

Console.WriteLine();

Console.ReadLine();

// Close the service.

serviseHost.Close();

}

}

I start my console program and I try this from another console.

svcutilhttp://localhost:8000/hello1/ out:proxy.cs

The answer I get is. Error. Unable to obtain Metadata fromhttp://localhost:8000/hello1/

/Godzilla9

[3316 byte] By [godzilla9] at [2007-12-20]
# 1

I assume that you're using the Feb CTP.

You will need to point to the baseaddress of the servicehost to get the metadata. So if you've got something like this:

WSHttpBinding binding1 = new WSHttpBinding();

Uri baseAddress1 = new Uri("http://localhost:23000/");

ServiceHost host = new ServiceHost(typeof(Test), baseAddress1);

host.AddServiceEndpoint(typeof(MyClass), binding1, baseAddress1 + "Hello/");

host.Open();

You can access your metadata at http://localhost:23000/.

I would try examing your metadata through IE too. It's a quick way of verifying that everything is in place.

Thanks!

Scott

ScottMason at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2

Ahh!!!

That works just fine!!!

Thanks alot!!!

/Godzilla9

godzilla9 at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified