We are trying move our web services from Azure Cloud Services to Azure Web Apps and that would change their address but we have some clients that we are not able to update the address they are using, so we are looking for a way to use the current cloud services server as a message forwarding server for those clients.

I am not an IIS admin so I tried to do some search and find out how to do it with ARR and URL Rewrite but it doesn't seem to work, so I am thinking even if this is the right approach to begin with!

I have enabled Proxy in ARR and created a rewrite rule in IIS for my app. Here is the result rewrite rule in web.config of the old address:

<?xml version="1.0" encoding="utf-8"?>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://new-address.azurewebsites.net/{R:1}" />

Is this the proper way to achieve this? Or do I need to look into solving the issue another way?

Thanks in advance.


Fixed the problem by using RoutingService instead of AAR and Url rewrite! Just had to add a web.config file in the empty folder and done!

<?xml version="1.0"?>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./MyService.svc" 
            service="System.ServiceModel.Routing.RoutingService,System.ServiceModel.Routing, version=, Culture=neutral,PublicKeyToken=31bf3856ad364e35" />
    <service name="System.ServiceModel.Routing.RoutingService" behaviorConfiguration="DefaultServiceBehavior">
      <endpoint name="basicHttpSampleService" address="" binding="wsHttpBinding" bindingConfiguration="sslBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter" />
      <endpoint address="mex" binding="mexHttpsBinding"  contract="IMetadataExchange" />
    <behavior name="DefaultServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <routing filterTableName="routingFilterTable" routeOnHeadersOnly="false" />
    <filter name="AddressFilter" filterType="MatchAll"/>
    <filterTable name="routingFilterTable">
      <add filterName="AddressFilter" endpointName="basicHttpSampleServiceClient"/>
        <binding name="sslBinding" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxReceivedMessageSize="2147483647">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
  <endpoint address="http://new-address.azurewebsites.net/MyService.svc"
    binding="wsHttpBinding" bindingConfiguration="sslBinding"
    contract="*" name="basicHttpSampleServiceClient" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.