2010-12-12 61 views
-4

大家好人都可以有人幫我用我的web.config文件?我有錯誤。我只是想讓你們看看它,如果有錯誤需要改正。謝謝大家:web.config錯誤

這是錯誤消息:

警告1 'targetFramework' 屬性未聲明。 G:\ gridview \ Web.config中顯示圖像17 62其他文件

消息2無法找到元素'模塊'的模式信息。 G:\ gridview \ Web.config中顯示圖像51 7其他文件

消息3找不到屬性'runAllManagedModulesForAllRequests'的模式信息。 G:\ gridview \ Web.config中顯示圖像51 15其他文件

錯誤4第10行的'配置'開始標記與'system.web'的結束標記不匹配。行101,位置4(C:\用戶\柯林斯\文檔\ Visual Studio 2005的\網站已\生活討神喜悅的世界\ web.config行101)

這裏是Web.config文件:

<?xml version="1.0"?> 
<configuration> 
<connectionStrings> 
    <add name="ConnectionString" 
      connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" 
      providerName="System.Data.SqlClient"/> 
</connectionStrings> 
<system.web> 
    <customErrors mode="Off"/> 
    <compilation debug="true"/> 
</system.web> 
<pages> 
    <namespaces> 
     <clear/> 
     <add namespace="System"/> 
     <add namespace="System.Collections"/> 
     <add namespace="System.Collections.Specialized"/> 
     <add namespace="System.Configuration"/> 
     <add namespace="System.Text"/> 
     <add namespace="System.Text.RegularExpressions"/> 
     <add namespace="System.Web"/> 
     <add namespace="System.Web.Caching"/> 
     <add namespace="System.Web.SessionState"/> 
     <add namespace="System.Web.Security"/> 
     <add namespace="System.Web.Profile"/> 
     <add namespace="System.Web.UI"/> 
     <add namespace="System.Web.UI.WebControls"/> 
     <add namespace="System.Web.UI.WebControls.WebParts"/> 
     <add namespace="System.Web.UI.HtmlControls"/> 
    </namespaces> 
</pages> 
<membership> 
    <providers> 
     <clear/> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> 
    </providers> 
</membership> 
<profile> 
    <providers> 
     <clear/> 
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/"/> 
    </providers> 
</profile> 
<authentication mode="Forms"> 
    <forms loginUrl="login.aspx" defaultUrl="Default.aspx"/> 
</authentication> 
<authorization> 
    <allow users="*"/> 
</authorization> 
<location path="PhotoAdmin"> 
    <system.web> 
     <authorization> 
      <deny users="?"/> 
     </authorization> 
    </system.web> 
</location> 
<system.net> 
    <mailSettings> 
     <smtp from="[email protected]"> 
     <network host="relay-hosting.example.net" password="" userName=""/> 
     </smtp> 
    </mailSettings> 
</system.net> 
</configuration> 
+5

你會得到什麼錯誤? – SLaks 2010-12-12 20:26:32

回答

2

好吧,有幾件事情搞砸了。

  1. 如果您正在使用的應用程序池被設置爲使用.Net框架4.如果是這種情況,那麼你應該有下的System.Web以下部分的targetFramework屬性必須被指定

    <compilation debug="true" targetFramework="4.0" /> 
    
  2. system.web部分太早關閉了。 「頁面」,「成員身份」,「個人資料」,「身份驗證」和「授權」部分必須是system.web的子部分。

+0

這是正確的答案。如果您使用.NET Framework 2.0,則將其更改爲2.0而不是上述答案中的4.0。 – Mal 2011-09-15 15:54:50

+0

我試過了 - 把'targetFramework =「2.0」'和intellisense告訴我'targetFramework屬性是不允許的'。 – bgmCoder 2013-10-26 18:33:11

+0

如果我正確地使用.Net 2. targetFramework是在4中引入的,所以舊版本的intellisense無法意識到它。 – Thea 2013-10-27 08:29:04