开发者

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

开发者 https://www.devze.com 2023-03-05 01:48 出处:网络
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 t

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();
_serviceH开发者_JAVA百科ost.Description.Behaviors.Add( serviceDiscoveryBehavior );


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消