Exposing WSDL on BasicHttpRelayBinding over Azure

孤者浪人 提交于 2019-12-07 06:43:17

问题


I have an svc that is auto-started using AppFabric. What I want to do is expose the wsdl for my service over the bus. Internally the service and the wsdl work fine of course, I can also consume the service over the bus with no issue. The only thing I can't configure properly is viewing the wsdl over the relay.

The ServiceHostFactory creates default endpoints and also adds an Azure Endpoint along with a mex endpoint in hopes to expose the wsdl over the relay. When I try to view the wsdl from the service bus url, I get the mismatch fault, probably due to ACS authentication failing?

...cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree

Do I need to set the mex endpoint up as anonymous authentication so I can go to a browser and view the wsdl? Just not sure what else to try... Any help would be appreciated!

Example url:

http://myservicebusexample.servicebus.windows.net/MyService/AService.svc?wsdl

or

http://myservicebusexample.servicebus.windows.net/MyService/AService.svc/mex

<serviceBehaviors>
   <behavior>
      <serviceMetadata httpGetEnabled="true" />
   </behavior>
</serviceBehaviors>

So here is my ServiceHostFactory

// Create host with default endpoints
ServiceHost host = new ServiceHost(serviceType, baseAddresses);
host.AddDefaultEndpoints();

// Create Relay Endpoint for Azure
ServiceEndpoint relayEndpoint = host.AddServiceEndpoint(typeof(IMyContract), new BasicHttpRelayBinding("MyAzureBindingConfiguration"), relayAddress);

// Apply ACS Credentials for the relay endpoint
relayEndpoint.ApplyEndpointBehaviorConfig("MyAzureACSCredentials");

// Create mex Endpoint to expose wsdl over the relay
ServiceEndpoint mexEndpoint = host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
                       new BasicHttpRelayBinding("MyAzureBindingConfiguration"),
                       "mex");

// Apply ACS Credentials for the mex endpoint
mexEndpoint.ApplyEndpointBehaviorConfig("MyAzureACSCredentials");

回答1:


Try adding the serviceBehavior which enables the metadata behavior:

 <behavior>
    <serviceMetadata />
 </behavior>


来源:https://stackoverflow.com/questions/13923026/exposing-wsdl-on-basichttprelaybinding-over-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!