我有一个使用 AppFabric 自动启动的 svc。我想要做的是通过总线为我的服务公开 wsdl。当然,在内部服务和 wsdl 工作正常,我也可以毫无问题地通过总线使用服务。我唯一无法正确配置的是通过中继查看 wsdl。
创建默认终结点,ServiceHostFactory
并添加一个 Azure 终结点和一个 mex 终结点,希望通过中继公开 wsdl。当我尝试从服务总线 url 查看 wsdl 时,出现不匹配错误,可能是由于 ACS 身份验证失败?
...cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree
我是否需要将 mex 端点设置为匿名身份验证,以便我可以转到浏览器并查看 wsdl?只是不知道还有什么可以尝试...任何帮助将不胜感激!
示例网址:
http://myservicebusexample.servicebus.windows.net/MyService/AService.svc?wsdl
或者
http://myservicebusexample.servicebus.windows.net/MyService/AService.svc/mex
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
所以这是我的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");