Jump to content

web.config on local IIS7, is it possible?


wilsonf1

Recommended Posts

I'm writing some web pages and doing some url rewriting via a web.config filethe rewrites are working on our live server, but I want them working locally too so I can work in a test environment.In IIS manager, I right clicked the folder I was working on, and clicked add applicationThe same working web.config file on live, generates this error locally:Cannot add duplicate collection entry of website'rule' with unique key attribute 'name' set to 'RewriteClubListings1'Config File \\?\C:\inetpub\wwwroot\EssentialIbiza\web.configRequested URL http://localhost:80/website/essibzPhysical Path C:\inetpub\wwwroot\website 6: 7: <rule name="RewriteClubListings1" stopProcessing="true"> 8: <match url="^club-listings/([^/]+)/([^/]+)?$" />Any ideas why this wouldn't work locally or any ideas what I need to do?Appreciate it

Link to comment
Share on other sites

"duplicate collection entry" sounds like you have a rule with the same name already.From the local IIS manager, can you see a rule with the same name anywhere? If you can, you might want to delete it before proceeding with web.config.

Link to comment
Share on other sites

"duplicate collection entry" sounds like you have a rule with the same name already.From the local IIS manager, can you see a rule with the same name anywhere? If you can, you might want to delete it before proceeding with web.config.
thanks for taking the time to read and reply to my questionthere are no url rewriting rules setup in iis managerthe problem is so strange that even if i have just 1 single rule in my web.config file, it will generate that error, and it doesn't matter which rule i put in there.if i move the order of all the rules, it's the first rule that generates the errorit seems SO far away from working locally, i almost can't believe it can do!
Link to comment
Share on other sites

Just to make certain... you do have the RewriteModule installed on the local machine, right? I mean, you know it's not bundled with IIS7...What if you try to set up the rewrite rules from IIS manager?<< Moved to the web servers forum >>

Link to comment
Share on other sites

Just to make certain... you do have the RewriteModule installed on the local machine, right? I mean, you know it's not bundled with IIS7...What if you try to set up the rewrite rules from IIS manager?<< Moved to the web servers forum >>
Looking at my history i've been on the rewritemodule webpage on iis.net and can see within modules its there:%SystemRoot%\system32\inetsrv\rewrite.dllI've tried for ages now to get them working from within IIS manager but I just don't think I'm setting them up right.Is the problem because the folder structures are different on my live server to local?So my live server is (first slash is root in both):/x-mysite-com/club-listings/index.asp?date={R:1}Where as on localhosts it's:/project-name/x-mysite-com/club-listings/index.asp?date={R:1} (this folder sits within (C:\inetpub\wwwroot\)Here is the rule in full again:<rule name="RewriteClubListings2" stopProcessing="true"><match url="^club-listings/([^/]+)/?$" /><action type="Rewrite" url="/x-mysite-com/club-listings/index.asp?date={R:1}" /></rule>I'm not great in IIS, i don't really understand setting up applications or whatever! So therefore i;m not sure how to replicate my live folder structure on localhost, is there a way to do it?
Link to comment
Share on other sites

Ok i think i'm making some progress, but it's all trial and error as i literally have no idea what i am doing!in IIS manager, if I click Default Website, then I click on my website folder nested within that tree, if i then click on URL Rewrite - I can see all my rewrite rules from my web.config file, hurray! so the 2 things can see each otherproblem is they still do not worki see some guy had exactly the same error as me: http://forums.gbpvr.com/showthread.php?374...eb.config-errornow i can right click my website folder and click Add Application - but what does that do other than change the icon from a folder to a website/server/whateveris this part of the key?REALLY appreciate you helping me, this is driving me nuts

Link to comment
Share on other sites

Ok here's another question.With rewriting URLS, can you for instance put in your source code a messy url like: index.asp?param1=value1&param2=value2Then your webconfiig file replaces those messy urls in your source for a cleaner version like: /value1/value2At the moment I'm coding my pages to have the clean URL output in the source code - but the fact my rewrites aren't working locally means this is a massive problem!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...