Wednesday, August 11, 2010

IIS 7 WebResource.axd forbidden Windows Server 2008

New site deployment using IIS 7.5 on Windows Server 2008 R2.



HttpException: Because your server does not support reflection or you set the attribute 'reflectionAlloweded="false"', You must specify a non-autogenerated machine key in your web.config to compress Webresource.axd


System.Web.HttpException
Mensagem: Because your server does not support reflection or you set the attribute 'reflectionAlloweded="false"', You must specify a non-autogenerated machine key in your web.config to compress Webresource.axd
Source: MbCompression
at Miron.Web.MbCompression.WebResourceCompressionModule.ThrowHttpException(Int32 num, String SRName)
at Miron.Web.MbCompression.WebResourceCompressionModule.GetDataFromQuery(NameValueCollection queryString)
at Miron.Web.MbCompression.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)





This issue is generated via the MbCompression library used to dynamically compress requests for Javascript files including the WebResources in asp.net 2.
My web.config does not have any configuration settings in the web.config for the Mbcompression library. The solution is very simple and was fixed by adding the Machinekey in the web.config in the section.