开发者

double headers sent by iis using mvc3

I'm currently in the process of upgrading my mvc2 to an mvc3 project. I've used the ASP.NET MVC 3 Application Upgrader and now i'm getting some weird behavior.

The http-reposonse-headers for a simple request now look like this:

HTTP/1.1 200 OK 
Cache-Control:private  
Content-Type: text/html;
charset=utf-8 
Server:Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNetMvc-Version: 2.0 
Server:Microsoft-IIS/7.5 
X-AspNet-Version:4.0.30319 
X-Powered-By: ASP.NET Date: Thu, 10 Feb 2011 09:12开发者_JAVA百科:52 GMT
Content-Length: 11416

Why is the server header sent twice and is there a header for both mvc2 and mvc3? Is this normal behavior or is something wrong here?


That is a bit puzzling, what I would probably recommend is three things:

1) Check that your web.config has an assembly binding redirect statement, something like this:


<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

2) Make sure your bin and obj folders are empty and clean out your Temporary ASP.NET Files folder (%FrameworkDir%\%FrameworkVersion%\Temporary ASP.NET Files)

3) Tripple check your referenced assemblies to make sure you only have 3.0 related ones

I am stabbing a bit at the dark here, because I am not quite sure how two handlers could possibly coexist so nicely and not cause you other issues. You can turn the headers off altogether by doing this on Application_Start in the global.asax.cs:


MvcHandler.DisableMvcResponseHeader = true;

but that will obviously also get rid of the one you presumably want and not solve the underlying problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜