IIS7里关闭不需要的组件
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="Profile" />
<remove name="Session" />
<remove name="RoleManager" />
<remove name="FormsAuthentication" />
<remove name="WindowsAuthentication" />
<remove name="DefaultAuthentication" />
<remove name="AnonymousIdentification" />
<remove name="OutputCache" />
<remove name="UrlAuthorization" />
<remove name="FileAuthorization" />
<remove name="UrlMappingsModule" />
</modules>
<handlers>
<clear />
<add name="PageHandlerFactory" path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" />
<!-- Add custom handlers here -->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
</system.webServer>
IIS7方便到可以在web.config里可以控制更多的东西。这些不需要的东西在modules里就那么多,像session那样的需要开了就行。 handlers里如果要加自定义的,一定要在StaticFileModule前添加。