https redirect in web.config gives "500" error

Hi.
Without a web.config file in the folder, when I browse to a file in that folder "http://mywebsite.net/gatewaytest.asmx", everything works.  Of course it is not secure (http).  I can also go to "https://mywebsite.net/gatewaytest.asmx" and I am successful (I get a little lock on the browser bar and the SSL cert properties can be displayed)

I want to create a standard-issue "https redirect" in a web.config file, which appears below.  

I copy the web.config file to that folder.  Then, when I browse to "http://mywebsite.net/gatewaytest.asmx", I believe it should re-write the address as "https" and bounce me to "https://mywebsite.net/gatewaytest.asmx", but I get an error:
 500 - Internal server error.
   There is a problem with the resource you are looking for, and it cannot be displayed


So, is there a problem in my web.config file, or do you think there is a problem elsewhere?
Thanks

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <remove name="Redirect to HTTP" />
                <rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="^OFF$" />
                        </conditions>
                        <action type="Redirect" url="https://{ToLower:{HTTP_HOST}{REQUEST_URI}}" appendQueryString="false" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window

Rob RudloffIT Development SpecialistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SriVaddadiCommented:
try  <clear\> in place of <remove name="Redirect to HTTP" /> and see if it works.

Just to know it is conflicting with any other rules
Rainer JeschorCommented:
Hi,
which OS / which IIS version?

If it is IIS 7 (or higher) - have you installed the URL rewrite modul?

For the error 500 - any further info / detailed error message in the Windows event log?

Thanks and HTH
Rainer

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob RudloffIT Development SpecialistAuthor Commented:
Rainer -- you are awesome!
The URL rewrite module was missing on this server.  (I never even thought to look, I'm so used to it already being there.)
I installed the module and everything works great now.
Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSL / HTTPS

From novice to tech pro — start learning today.