I just migrated from 2003 to 2012 and everything went smoothly. I have now reached the part I was dreading.... redirecting requests for my old ASP.Net web services over to an alternative server that still supports them. I can't believe how difficult Microsoft have made something that should be so simple. Anyhoo, there are applications out there consuming my web services at http://olddomain/myWS/myWS.asmx I have setup the web services at http://newdomain/myWS/myWS.asmx so my question is what is the quickest, dirtiest way to put a redirection in place on my new 2012 IIS 8 server so that requests are sent to the replacement server?
302 Redirects can be handled by the HTTP Redirect module. Other redirects can be handled using the URL Rewrite module.
I am aware of both of those modules but I don't know how to use either of them. I have been unable to fond examples that come close to solving my specific problem and I was hoping someone could give me a step by step example.
URL Rewrite is my preferred module but I get an error in my web.config when I use IIS Manager to add a mapping. Is there somewhere on the DASP server that I need to enable URL Rewrite?
Here are a couple of links you can look at for examples: http://blog.discountasp.net/url-rewrite-2-0-for-iis-7-is-here/ http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx You don't need to enable URL Rewrite. The module is already available to you.
What is the error message that you get when you setup URL Rewrite/Redirect rules on your URL Rewrite Module? Do you have a link we can look at?
This video might also help you out too: http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-video-walkthrough
Thanks for your help guys There is no error in IIS Manager and the following code block gets inserted at the bottom of the web.config file in the root folder of my app: <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> <staticContent> <mimeMap fileExtension=".cfg" mimeType="text/plain" /> </staticContent> <rewrite> <rules> <rule name="wsVMRedirect" patternSyntax="ExactMatch"> <match url="http://www.ipalarms.net/wsvm/wsvm.asmx" /> <action type="Rewrite" url="http://vm.thruhere.net/wsvm/wsvm.asmx" /> </rule> </rules> </rewrite> </system.webServer> I download the web.config file and open it in Visual Studio 2012. The <rewrite> tag is underlined and when I put my mouse over it the error is: The element 'system.webServer' has invalid child element 'rewrite'. It then goes on to give a list of possible elements that are expected. I also tried inserting the rewrite code block in the web.config file in the wsVM folder, but either way, the redirect does not work.
That's because the <rewrite> XML tag should not be a child element of <system.webServer>. The format should look like this:
So the URL Rewrite module in IIS Manager does not work correctly. As a fix, I edited the web.config manually and tried the following outside of the system.webServer element and I get an error as I request the .asmx <rewriter> <rewrite /> <rules> <rule name="wsVMRedirect" patternSyntax="ExactMatch"> <match url="http://www.ipalarms.net/wsvm/wsvm.asmx" /> <action type="Rewrite" url="http://vm.thruhere.net/wsvm/wsvm.asmx" /> </rule> </rules> </rewriter> also tried: <rewriter> <rewrite> <rules> <rule name="wsVMRedirect" patternSyntax="ExactMatch"> <match url="http://www.ipalarms.net/wsvm/wsvm.asmx" /> <action type="Rewrite" url="http://vm.thruhere.net/wsvm/wsvm.asmx" /> </rule> </rules> </rewrite> </rewriter>
I think we are looking at this all wrong. We are troubleshooting base of what your VS shows. You probably don't have the URL Rewrite Module installed on your computer that is why VS does not recognize the element. If the server itself does not recognize the element, you would definitely see the error on your browser. I suspect it maybe the rules and conditions you setup. But it is hard to say because the currently rules you maybe setting is a bit complex. Rather setup a simple rule, where if some one types http://ipalarms.net it gets rewritten/redirected to http://www.ipalarms.net. Let's start from there and work our way to a more sophisticated rule.