2017-05-30 110 views
3

我正在将现有服务迁移到Azure服务结构。我现有的应用程序支持传统用户的soap服务(asmx)。我想使用相同的Web服务作为我的微服务的一部分。 Web服务test.asmx(比如说)也可以从Rest Apis中调用(如果soln在那里)。但是我没有找到任何方法将soap服务用作Azure服务结构微服务方法的一部分。帮助我摆脱解决Web服务场景的可能解决方案。谢谢!在Azure服务结构中使用soap服务(.asmx)

回答

4

我建议您的ASMX服务converting到带有BasicHttpBinding的WCF服务。然后,您可以将您的WCF服务托管在无状态的SF服务中,如here所示。

private static ICommunicationListener CreateRestListener(StatelessServiceContext context) 
{ 
    string host = context.NodeContext.IPAddressOrFQDN; 
    var endpointConfig = context.CodePackageActivationContext.GetEndpoint("CalculatorEndpoint"); 
    int port = endpointConfig.Port; 
    string scheme = endpointConfig.Protocol.ToString(); 
    string uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}/", scheme, host, port); 
    var listener = new WcfCommunicationListener<ICalculatorService>(
        serviceContext: context, 
        wcfServiceObject: new WcfCalculatorService(), 
        listenerBinding: new BasicHttpBinding(BasicHttpSecurityMode.None), 
        address: new EndpointAddress(uri) 
    ); 
    return listener; 
}