Archive for category IIS
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!
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.
I 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>
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.
ASP.net aspx pages posting back to the wrong URL when using Server Rewrite
Posted by shawson in .net, URL Rewriting on May 4th, 2010
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
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
Helicon ISAPI Rewrite rules ignored – You must save the rewrite file with ANSI encoding- NOT UTF8!!
We recently had problems with Server Rewrite rules not working when uploading a new site. The rules had worked fine locally, on dev, but when we uploaded it wasn't having any of it. The rules were in the httpd.ini file which sat in the root of the site- the syntax of the rules was identical to other file's we had used on other sites. After much head scratching Paul suggested it might be the encoding of the file- we opened it in Notepad and went to save as and changed the file from the default "UTF" to "ANSI" encoding and everything started working!
Move from BlogEngine.net to WordPress 2.7.1!
I’m a .net developer by day, so am always keen to use .net technologies where ever possible. For the past few months I’ve been persevering with BlogEngine.net, a dot net blogging platform which I run on my Windows 2k8 IIS7 box from home, however I can do it no more! I’ve found myself looking on with envy at the features in the newer builds of WordPress as i struggle on with the various “quirks” of BlogEngine and finally decided I could no longer put up with it- I’ve made the switch to WordPress which I’ve used in the past and I have to say I’m pleasantly surprised- not only is it as good as i remember, but it’s come on leaps and bounds both feature and interface wise since I last used it.
To get WordPress up and running I had to setup PHP5, mySQL (and phpMyAdmin to save me the pain of mySQL command line syntax again) under IIS7 which I also found to be easy (all up and running within an hour!) following the guides over on the TrainSignal training website
The Path ‘/AppName/App_GlobalResources’ maps to a directory outside this application, which is not supported.
I recently had a crazy problem on one of my asp.net 2 projects which had previously been working for ages. I had recently had to change my localhost site root in IIS on my local dev box to another projects root to make some 3rd party site run, as it refused to run unless it was at the root of IIS.
So, once finished, I reverted the my default site’s home directory back to C:\inetpub\wwwroot\ to continue work on other projects.
When i returned to work on one of my older projects which ran in a sub folder under my local machines IIS root, i was hit with a random error;
Server Error in ‘/SharedCheckout’ Application.
The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside this application, which is not supported.
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.Exception Details: System.Web.HttpException:
The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside
this application, which is not supported.
I was particularly confused by this because I hadn’t added the special App_GlobalResources directory to my project through visual studio. Anyway after a bit of googling I found this to be due to IIS being completely confused by the extra trailing \ when defining the home directory for my site definition- so i changed it to C:\inetpub\wwwroot (removing the trailing \) and everything was back to normal.
Localisation – American Date’s and currencies in ASP.net
Handy web.config value to know – in Dot net if you find everything being americanised when you're not expecting it try this in your web.config under the system.web section -
<globalization culture="en-GB" />
you can obviously replace this with any of the other standard country codes.
MySQL 5 / phpMyAdmin Installation – root account not accepted
I recently installed mysql 5 under Windows 2003, with phpMyAdmin running under IIS 6 and came across an issue trying to get phpMyAdmin to access the database- I found that the root credentials were’nt accepted. The error i receive was
“#1251 – Client does not support authentication protocol requested by server; consider upgrading MySQL client”
Apparently this is to do with me using an older version of phpMyAdmin and how the passwords are encrypted- I found an article on WebMasterWorld detailing how to resolve it;
Login from the command line to your MySQL database;
mysql -u root -h localhost -p
- -u lets you set the username to use, in this case I’m using the root account
- -h sets the host- I’m logging in from the local machine so used localhost- I havn’t enabled root access from any remote machines
- -p indicates that you will be supplying a password
You will then be prompted the enter the password for your database. Once you’re in, execute the following sql to update the password
UPDATE mysql.user
SET password=OLD_PASSWORD('somepassword')
WHERE user='someuser';
AND host='somehost';
Once that’s done you will also want to flush the priviledges;
flush privileges;
You can now safely quit the mysql client with ‘exit’ and you are set!
This is also covered on the mySQL documentation site.