Archive for category IIS

IIS 7 Permissions – Application Pool Identity User Accounts

In IIS7- when using app pools which use the app pool identity, you can find the user account (for use with ACL) in the “IIS AppPool” domain- so you can reference the app pool accounts with IIS AppPool\<app pool name>

More info can be found here; http://learn.iis.net/page.aspx/624/application-pool-identities/

No Comments

IIS Express hanging when launched from visual studio

I recently built up a new machine at work and grabbed all my latest projects out of SVN only to find that one of them no longer seemed to start.

Since checkout I hadn’t changed any code, got a clean build, but when the browser window opened it just hung, with no error.

I eventually found this was because I was using the UrlRewrite module on the site (with the rules in the web.config file) but had forgotten to install this component on my IIS on the new machine. An error message would have been nice!

No Comments

IIS7 UrlRewrite Outbound links with Compression Enabled

I’ve recently started using the outbound link rewriting feature in the url rewrite module for IIS7, but initially ran into some problems.

In my web.config, my rewrite section (under system.webServer) looked something like this;

    <rewrite>
      <rules>
        <rule name="InboundFriendlyAboutUs" stopProcessing="true">
          <match url="^about-our-car-finance$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="About-Us.aspx" />
        </rule>
      </rules>
      <outboundRules>
        <rule name="OutboundFriendlyAboutUs" preCondition="IsHtml">
          <match filterByTags="A, Form" pattern="^(.*)About-Us\.aspx$"/>
          <action type="Rewrite" value="{R:1}about-our-car-finance"/>
        </rule>
        
        <preConditions>
          <preCondition name="IsHtml">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html"/>
          </preCondition>
        </preConditions>
      </outboundRules>
    </rewrite> 

However when I tried to view the page I received a server error;

HTTP Error 500.52 – URL Rewrite Module Error.
Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded (“gzip”).

This is because I also had the IIS7 dynamic and static compression enabled, as is sensible for any website. It turns out that, while dynamic compression is supported, static is not- and dynamic requires a little bit of fiddling to get going. I’ll boil it down to a few steps;

  1. On the machine running the web site, from the command line run:
    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0
    You may need to follow this up with an iisreset
  2. Add the following to the top of your system.webServer section of your web.config file to disable the unsupported static compression while leaving dynamic unharmed;

    <urlCompression doStaticCompression=”false” doDynamicCompression=”true” dynamicCompressionBeforeCache=”false” />

  3. The final step, is probably not needed- but! Open up your IIS management console- Click on the top level item, from the IIS segment open the “Modules” component. From within here on the right hand side bar, click “View ordered List…” and make sure RewriteModule appears in the list BELOW the DynamicCompressionModule. For me, this was already the case- my RewriteModule appeared at the very bottom, but this may not be the case for you.

If you’re after more details- my source was here; http://forums.iis.net/t/1165899.aspx

6 Comments

MSDeploy Setup Guide & How to Call Server Side Method Using jQuery/Ajax

Couple of interesting items popped up in the RRS feed’s this morning.

Automating Deployment with Microsoft Web Deploy – ScottGu’s Blog.

Calling Server Side Method Using jQuery/Ajax – Karan’s Blog.

No Comments

Introducing the Microsoft Web Farm Framework – ScottGu’s Blog

Introducing the Microsoft Web Farm Framework – ScottGu’s Blog.

No Comments

ASP.net File Uploads with NeatUpload

File Uploads are a fickle thing, and have been.. well.. always. ASP.net has it’s own default max file size, IIS is also put under strain while processing large files and trapping excpetions when file’s are too large, or providing progress bars during the process is a fiddly process.

I’ve recently started using NeatUpload which is an HttpModule which takes care of uploads, streaming the data straight to storage on the file system, or sql- taking a load off of IIS and also offering progress bars!

It’s a fairly old project, which has only recently gone up on codeplex- check it out!

,

2 Comments

WordPress 500 Error when submitting a blank comment form under IIS7 and PHP5

I recently noticed an issue on this very blog and a couple i have hosted on this server when people just hit submit on the comment form without entering anything into the comment field- i would get a 500 server error back.

error_pagesI spent ages googling figuring it was some kind of config error on the server as it happened across all of the wordpress blogs on this server- I eventually found it wasn’t an error at all- The skins used across these blogs didn’t seem to validate the forms so it was falling back to wordpress which was returning an error like “Error: please type a comment.”- however IIS seemed to be intercepting this as a full error and rendering a 500 error- the solution was simple!  Turn on detailed error’s.  Obviously this isn’t good on a production box running dot net, but for PHP you can control the error reporting from within the php.ini file anyway, so this just makes sure IIS doesn’t add an additional layer of error filtering confusing matters.

Update: Thanks to Kanwaljeet Singla on the comments for pointing out a better fix for this as detailed on Kern Handa’s blog here.  This can basically be fixed easily by setting a web config entry to tell IIS to let errors pass through, like so;

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration>

2 Comments

Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI

I recently rebuilt a Windows 2008 server and set it up with PHP5 and FastCGI under IIS7 for a bunch of word press blogs. I came to the end of the install and was setting rights to the wp-content folders so people could upload attachments, but ran into some troubles.  I dunno if this changed because of Service Pack 2, but I found I now have to assign the rights, not to “Network Service” which is the Identity of the app pools, and not to “ISS_IUSRS” group, but to an account simply called “IUSR”.  I’m sure previously i just assigned permission to the network service account?  And surly IUSR would be a member of IIS_IUSR’s by default?  I dunno!  Anyway I had to use procmon to monitor the requests and see which account was actually being used.

So to conclude; You need to give modify permissions to the wp_content folder, to the IUSR user and the user your App Pool runs as (eg; ‘IIS APPPool\codeblog.shawson.co.uk’)

3 Comments

ASP.net aspx pages posting back to the wrong URL when using Server Rewrite

Had a problem today working on a new phase of one of our existing sites (a problem which I’m sure I came up against on another site and fixed a few years ago…) – we just added server rewrite with a whole new URL structure like so;

www.site.com/ group name/ series name/ book.htm

This allows the user to chop off a folder and get back to the relevant listing page- pretty standard stuff now days.  So this introduces a bunch of virtual folders.  All the sites resources were set to use absolute paths and everything was loading in and rendering fine, but the page crashed every time I click the “Add to cart” button– bit of a show stopper.

This was because dot net isn’t aware of the rewrite- so while they hit the site on a url like;

childrens-books/beast-quest/book1.htm

asp.net thought the page was at

book-details.aspx?id=9780123456789&catId=1&seriesId=2

so did a post back to that page, relative to the current folder, giving me;

childrens-books/beast-quest/book-details.aspx?id=9780123456789&catId=1&seriesId=2

trying to reference the physical file (which existed at the root level) from the context of a folder which doesn’t really exist.  The fix is easy (once you find it!) – for this site the main asp.net form tag was in the masterpage so I just added the following to the Page_Load of my master page;

form1.Action = Request.RawUrl;

Thanks to Ruslan Yakushev’s post on IIS.net

No Comments

Windows Vista, Visual Studio 2003/5 and Front Page Extensions!

We recently got new machines at work with Vista installed, allowing us to use IIS7, which has the added benefit of being able to run more than one site on the local IIS (unlike our previous IIS6 Win XP boxes)

When installing the various incarnations of visual studio to enable me to support some of our legacy app’s I came across a problem when installing Visual Studio 2003. One of the pre-requisites is front page extensions which are no longer shipped with Windows in Vista- the solution was a version of the extensions made by ready to run software which is actually linked to from the Official IIS Site (the article is named “FrontPage 2002 Server Extensions for IIS 7.0″ incase you have to use the site search, after another of microsoft’s random url switch around’s they’re so fond of) -you can grab the install from here : http://www.rtr.com/fpse/

Once you’ve run the installer, make sure you execute the following from the command line to activate them for your default website otherwise the .net installer still won’t recognise that you have them installed;

 owsadm.exe –o install 

,

No Comments