Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Saturday, May 25, 2013

Server Side Include in IIS Express

To enable SSI in IIS Express, open configuration file:

C:\Users\%user%\Documents\IISExpress\config\applicationhost.config

and within it make sure that:
1) SSI is enabled - within "globalModules" section should be a tag: <add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" />

2) set a default document with "shtml" - within "defaultDocument" section add e.g. <add value="index.shtml" />

One more thing to note about SSI files. I was struggling a lot with includes breaking my page layout - adding empty line in every spot where #include was used. Apparently the problem is with encoding of the file. So instead of using "Unicode (UTF-8 with signature)", save your include files with "Unicode (UTF-8 without signature)" - in visual studio you can set this in menu File -> Advanced Save Options...

Saturday, April 16, 2011

Ajax SVC getting 404 error when using https

We're using AJAX WCF service for javascript calls.
All worked well while we were running under http, but when we went to production and switched to https, all of a sudden service wasn't workin. Following was happening:

http://mytest.com/test.svc/js - worked fine
https://mytest.com/test.svc - worked fine
https://mytest.com/test.svc/js - 404 error

Turned out we were missing binding configuration for https. This blogpost describes how to fix it (i'm attaching the XML fragment just in case the blog goes missing...)

<system.serviceModel>
<behaviors>    
 <endpointBehaviors>
  <behavior name="TestServiceAspNetAjaxBehavior">
   <enableWebScript />
  </behavior>
 </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
 <service name="TestService">
  <endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
   binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
 </service>
</services>
 <bindings>
   <webHttpBinding>
     <binding name="webBinding">
       <security mode="Transport">
       </security>
     </binding>
   </webHttpBinding>
 </bindings>
</system.serviceModel>

Tuesday, November 30, 2010

IE8 wrong style rendering on IIS / ASP.Net Dev server

I've ran into issues when site renders perfectly in VS's ASP.Net Dev Server on IE8, but when published to IIS, some styles are messed up. To make it even more confusing, it renders correctly when displayed locally on the web server and incorrectly when accessed from different machine.
Apparently I'm not the only one having this issue - and the solution is simple. Let IE know that the page should be rendered in correct mode.

Solution 1 - add following to the 'head' tag of the page:
<meta http-equiv="X-UA-Compatible" content="IE=8" />

Solution 2 - add this section to the web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

The detailed description from Microsoft is here.