shyamkumar

Hello,

I have a programatic web service configuration using mixed modeC++ (CLI)
and C#. The service is able to add the service endpoint and IMetadataExchange endpoint
and the WCF is able to open the ServiceHost with out any errors.

But after the service started i tried to use the svcutil.exe to generate the metadata for
the service. But i am getting an error as follows.

svcutil /t:metadata http://localhost:9000/DiskService/mexHTTPDiskProvisioningService
WS-Metadata Exchange Error
URI: http://localhost:9000/DiskService/mexHTTPDiskProvisioningService
Metadata contains a reference that cannot be resolved: 'http://localhost:900
0/DiskService/mexHTTPDiskProvisioningService'.
Could not connect to http://localhost:9000/DiskService/mexHTTPLunProvisioningS
ervice. TCP error code 10061: No connection could be made because the target mac
hine actively refused it.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it
HTTP GET Error
URI: http://localhost:9000/DiskService/mexHTTPDiskProvisioningService
There was an error downloading 'http://localhost:9000/DiskService/mexHTTPLunPr
ovisioningService'.
Unable to connect to the remote server

I also added the service behavior with HttpGetEnabled and HttpGetURL properly
with security mode of WSDualHttpBinding security set to none. But i couldnot generate
the metadata. I was able to generate the NetTCPBinding metadata for the same service with out any issues. Can somebody please help me as i am really stuck here.


(defined in c# assembly)
-----------------------------------
public class URIConstant
{
public const string
HTTPServiceBaseAddress = "http://{0}:{1}/DiskService/";
public const string
HTTPDiskProvisioningMex = "http://{0}:{1}/DiskService/mexHTTPDiskProvisioningService";
}

(defined in c++ CLI codebase)
--------------------------------------------------------------------------------
System::Uri ^httpbaseaddress;
System::Uri ^httpMexbaseaddress;

httpbaseaddress = gcnew Uri(String::Format(URIConstant::HTTPServiceBaseAddress, "localhost", "9000"));
httpMexbaseaddress = gcnew Uri(String::Format(URIConstant::HTTPDiskProvisioningMex, "localhost", "9000"));

// i am using singleton pattern to create the service class instance.
DiskProvisioningService ^singleton = DiskProvisioningService::GetUniqueInstance();
DiskProvisioningServiceHost = gcnew ServiceHost(singleton,httpbaseaddress);


WSDualHttpBinding ^bindingHTTP = gcnew WSDualHttpBinding();
bindingHTTP->ReceiveTimeout = TimeSpan::MaxValue;
bindingHTTP->Security->Mode = WSDualHttpSecurityMode::None;

EndpointAddress ^httpendPointAddress = gcnew EndpointAddress(
gcnew Uri(String::Format(URIConstant:Big SmileiskProvisioningServiceHTTPBaseAddress, "localhost", "9000")));

ServiceEndpoint ^httpDiskProvisioningEndPoint = DiskProvisioningServiceHost->AddServiceEndpoint(SDManagedInterfaces::IDiskProvisioningService::typeid, bindingHTTP, "DiskProvisioningService");


ServiceMetadataBehavior ^smb = DiskProvisioningServiceHost->Description->Behaviors->Find<ServiceMetadataBehavior^>();
if (smb == nullptr)
{
smb = gcnew ServiceMetadataBehavior();
smb->HttpGetEnabled = true;
smb->HttpGetUrl = httpMexbaseaddress;
DiskProvisioningServiceHost->Description->Behaviors->Add(smb);

}
else
{
smb->HttpGetEnabled = true;
smb->HttpGetUrl = httpMexbaseaddress;
}

DiskProvisioningServiceHost->AddServiceEndpoint(IMetadataExchange::typeid, gcnew WSDualHttpBinding(), httpMexbaseaddress);

DiskProvisioningServiceHost->Open();
--------------------------------------------------------------------------------
any help is really apprecited

Thanks,
Shyam


Re: Windows Communication Foundation (Indigo) SVCutil.exe failed to generate metadata for WSDualHttpBinding.

Dwight Goins

Your error seems to specify that you have a typo or something:

No connection could be made because the target machine actively refused it
HTTP GET Error
URI: http://localhost:9000/DiskService/mexHTTPDiskProvisioningService
There was an error downloading 'http://localhost:9000/DiskService/mexHTTPLunPr
ovisioningService'.
Unable to connect to the remote server

Is the Mex address http://localhost:9000/DiskService/mexHTTP[DISK]...

or

http://localhost:9000/DiskService/mexHTTP[LUN]...






Re: Windows Communication Foundation (Indigo) SVCutil.exe failed to generate metadata for WSDualHttpBinding.

shyamkumar

Hi Dwight Goins,

Please read it as http://localhost:9000/DiskService/mexHTTP[DISK]...

it was a typo when i was writting in the forum. Do you see anything wrong in the code which can cause this error .

Thanks,
shyam





Re: Windows Communication Foundation (Indigo) SVCutil.exe failed to generate metadata for WSDualHttpBinding.

JDPeckham

Code Snippet
Could not connect to http://localhost:9000/DiskService/mexHTTPLunProvisioningS
ervice
. TCP error code 10061: No connection could be made because the target mac
hine actively refused it.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it

  1. while the host is running and you do a netstat -a can you see the port open and listening
  2. is windows firewall turned on, is there an exception for the service host if so
  3. is there other firewall software or hardware that would actively block port 9000
  4. since it says localhost, is it indeed running on your local machine have you tried using it's actual machine name or ip address instead of "localhost"

When the target machine actively refuses the connection it's usually that the port is not listening at all. If the port is not listening, has your servicehost gone out of scope and closed itself






Re: Windows Communication Foundation (Indigo) SVCutil.exe failed to generate metadata for WSDualHttpBinding.

shyamkumar

Hi JDPeckham

netstat -a shows the following, and as you mentioned service is really running
on the port 9000.

Active Connections

Proto Local Address Foreign Address State
TCP EXCH1:9000 EXCH1.SMDEV.LAB.SMDEVDOMAIN.com:0 LISTENING

There is no firewall enabled on this machine, and there is no software or hardware blocking
the port 9000.

The same service can create tcp endpoints with out any issues and i can generate the mex for the
tcp endpoints(running on 8000).

Since i use the code base service instantiation i debuged the service to make sure
that http endpoint http://localhost:9000/DiskService/mexHTTPLunProvisioningService
is created and running(not out of scope).

Thanks for your input, please let me know if you get any more ideas.

Thanks,
Shyam







Re: Windows Communication Foundation (Indigo) SVCutil.exe failed to generate metadata for WSDualHttpBinding.

Brian McNamara - MSFT

You should use MetadataExchangeBindings.CreateMexHttpBinding() for the mex endpoint binding. That is, this

DiskProvisioningServiceHost->AddServiceEndpoint(IMetadataExchange::typeid, gcnew WSDualHttpBinding(), httpMexbaseaddress);

is wrong, you should change the binding.