Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Scope defaults to tempuri despite being explicitly and programmatically added to service

Tags:

scope

.net

wcf

On the service end I have a service host spinning up in the context of a Windows service. Everything seems to go fine: the service spins up and can be discovered. But when I go to check the scope at the client that I explicitly added in the service (no matter what the value) I get the following value: {urn:http://tempuri.org/:MyServiceInterface}

The service side discovery code looks like this:

var udpDiscoveryEndpoint = new UdpDiscoveryEndpoint();
//
// Create a scope unique to this machine for filtering purposes and add it to the discovery behavior
//
var endpointDiscoveryBehavoir = new EndpointDiscoveryBehavior();
endpointDiscoveryBehavoir.Scopes.Add( new Uri( address + "/disco" ) );
udpDiscoveryEndpoint.Behaviors.Add( endpointDiscoveryBehavoir );
//
// Add discovery endpoint
//
_serviceHost.AddServiceEndpoint( udpDiscoveryEndpoint );
ServiceDiscoveryBehavior serviceDiscoveryBehavior = new ServiceDiscoveryBehavior();
_serviceHost.Description.Behaviors.Add( serviceDiscoveryBehavior );
like image 541
Ian Avatar asked Dec 05 '25 04:12

Ian


1 Answers

As I guessed, you might add a metadata endpoint to your service as well? If it's the case, you should add the scope behavior to your metadata endpoint as well, so that you can discover the service with the right scope.

Cheers.

like image 173
Toan Nguyen Avatar answered Dec 07 '25 18:12

Toan Nguyen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!