This problem that you will see in the Every standard environment is that
once you deploy your service to one of the environments the URI that comes back in the WSDL
now has a port number in it and when you try and browse to it or use a tool to generate a proxy it fails (due to security reasons on the network).
It's a strong recommendation to upgrade your ASMX to WCF due to it's clear benefits that you may already know. An additional specific thing that you may or may not know is that the above issue could be easily handled by just making a small change in the service configuration in the web.config file if using WCF. And here is an excellent article on how and what precisely you need to do. It may take some time depending on the service conplexity but its worth it.
However if you decide not to and want to continue with the ASMX service itself due to some reason
then below is the explanation on how to tackle the invalid Uri in the ASMX WSDL document.
The way you can control the load balancer mess is by injecting the WSDL request and replacing
inaccessible Uri with the correct Uri in the WSDL document.
This could be done via inheriting the SoapExtensionReflector class from System.Web.Services.Description.
Create a class like this -
Public Class LoadBalancerPortMessFix
Public Overrides Sub ReflectMethod()
Public Overrides Sub ReflectDescription()
Dim Description As ServiceDescription= ReflectionContect.ServiceDescription
For Each Service as Service In description.Services
For Each port as POrt in Service.Ports
For each Extenstion AS ServiceDescriptionFormatExtension In POrt.Extensions
Dim Soapbinding as SoapAddressBinding= DirectCast(extension,SoapAddressBinding)
If not Soapbinding Is Nothing Then
'User Appropriate Logic Here
soapbinding.Loacation=Regex.Replace(Soapbinding.Location, ":[0-9]+", String.Empty)
You can also Control Http|Https if needed.
And then configure this class to allow intercept the WSDL generation
'Fully Qualified Name of the Class
<add type="MyProject.MyApplication.web.PortMessFix, MyApplication" />
After doing that we can see that the WSDL now generates with the replaced URI and
we are able to both browse it and use tools to generate proxies against it.
-<wsdl:port name="StudentsSoap" binding ="tns:StudentsSoap">
-<wsdl:port name="StudentsSoap2" binding ="tns:StudentsSoap2">
No responses found. Be the first to comment...