首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

关于IIS7.5部署有关问题,很急

2012-10-16 
关于IIS7.5部署问题,很急!刚学习IIS的部署,就遇到了郁闷半天的问题书里说IIS7.5采用整合模式 可以让非asp.

关于IIS7.5部署问题,很急!
刚学习IIS的部署,就遇到了郁闷半天的问题
书里说IIS7.5采用整合模式 可以让非asp.net网页和asp.net网页一起通过表单验证的,我按书本配置了web.config

C# code
<?xml version="1.0" encoding="UTF-8"?><!--    注意: 除了手动编辑此文件外,您还可以使用     Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的    “网站”->“Asp.Net 配置”选项。    有关设置和注释的完整列表可以在    machine.config.comments 中找到,该文件通常位于      \Windows\Microsoft.Net\Framework\vx.x\Config 中 --><configuration>    <appSettings>        <add key="ConnectionString" value="server=(local);Uid=sa;pwd=tc13376543186;database=DBFlower;" />    </appSettings>    <connectionStrings>        <remove name="LocalSqlServer" />        <add connectionString="Data Source=JY-PC;Initial Catalog=aspnetdb;User ID=sa;Password=tc13376543186" name="LocalSqlServers" />        <add connectionString="Data Source=JY-PC;Initial Catalog=aspnetdb;User ID=sa;Password=tc13376543186" name="LocalSqlServer" providerName="System.Data.SqlClient" />        <!--<add name="memberConnectionString" connectionString="Data Source=(local);Integrated Security=SSPI;Initial Catalog=aspnetdb;User ID=sa;"/>-->    </connectionStrings>    <system.web>        <!--             设置 compilation debug="true" 可将调试符号插入到            已编译的页面。由于这会            影响性能,因此请仅在开发过程中将此值            设置为 true。        -->        <roleManager enabled="true" />        <compilation debug="true" targetFramework="4.0">            <assemblies>                <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />            </assemblies>        </compilation>        <!--                          通过 <authentication> 节可以配置          安全身份验证模式,ASP.NET           使用该模式来识别来访用户身份。         -->        <authentication mode="Forms">            <forms name="AuthCookie" loginUrl="Default.aspx" />        </authentication>        <membership defaultProvider="MyMembershipProvider">            <providers>                <add connectionStringName="LocalSqlServers" applicationName="/" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider" />                <add connectionStringName="LocalSqlServers" applicationName="/" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" name="MyMembershipProvider2" type="System.Web.Security.SqlMembershipProvider" />            </providers>        </membership>        <authorization>            <!--设置资源为受保护,匿名不允许访问-->            <deny users="?" />        </authorization>        <!--           如果在执行请求的过程中出现未处理的错误,           则通过 <customErrors> 节           可以配置相应的处理步骤。具体而言,           开发人员通过该节可配置要显示的 html 错误页,           以代替错误堆栈跟踪。           <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">             <error statusCode="403" redirect="NoAccess.htm" />             <error statusCode="404" redirect="FileNotFound.htm" />           </customErrors>        -->        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />    </system.web>    <!--允许特定页访问-->    <location path="allow">        <system.web>            <authorization>                <allow users="*" />            </authorization>        </system.web>    </location>    <system.webServer>        <modules>            <remove name="FormsAuthentication" />            <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>        </modules>    </system.webServer>    <!--         system.webServer 节是在 Internet Information Services 7.0 下运行 ASP.NET AJAX        所必需的。对早期版本的 IIS 来说则不需要此节。    --></configuration> 




在VS上运行良好,访问根目录下的一个html页时可以通过表单验证转到登录页,可是到了IIS就不行了
我试过编辑FormsAuthentication托管模块,让它不仅仅针对asp.net应用程序,没想到居然弹出个窗口
说:
无法在此应用程序的引用程序集中找到指定的类型。请确保已将程序集添加到应用程序的WEB.config的system.web/compilation中的程序集列表,仍要继续吗?
我点是,所以web.config就自动加上
<system.webServer>
  <modules>
  <remove name="FormsAuthentication" />
  <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
  </modules>
  </system.webServer>
跟书上一样啊,可是在IIS浏览那个html页的时候 就死活不肯转到登录页,我百度半天了,求知道的人帮我
附:我是用VS2010创建的网站 .net4.0的,应用程序池也用了asp.net 4.0的集成模式,form身份验证和匿名身份验证已启用了。

[解决办法]
<modules runAllManagedModulesForAllRequests="true">


或者

<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
<add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />
<remove name="UrlAuthorization" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<remove name="DefaultAuthentication" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" />
</modules>
</system.webServer> 

试试

热点排行