加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在应用程序级别之外注册为allowDefinition =’Machin

发布时间:2020-12-15 22:25:43 所属栏目:asp.Net 来源:网络整理
导读:将System.Data.Entity的声明添加到我的Web配置后,我收到此错误: 在应用程序级别之外使用注册为allowDefinition =’MachineToApplication’的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的. 我删除了obj和bin文件夹,我删除了行身份
将System.Data.Entity的声明添加到我的Web配置后,我收到此错误:
在应用程序级别之外使用注册为allowDefinition =’MachineToApplication’的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.

我删除了obj和bin文件夹,我删除了行身份验证=“windows”,试图重新打开,因为有人说它有效,我检查了主文件夹中只有1个web.config(实体框架 – 文件夹形式,型号,DAL和BLL)……

还有什么其他原因会发生这种情况?我到处搜索,基本上是我发现的上述原因….

这是我的web.config,如果它有所不同:

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
     connectionString="data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />
    <add name="CStringVKB" connectionString="Data Source=.;Initial Catalog=VKB;Persist Security Info=True;User ID=websiteservice;Password=websiteservice" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" optimizeCompilations="true" targetFramework="4.0" >
      <assemblies>
        <add assembly="System.Data.Entity,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <!--<authentication mode="Windows">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>-->
     <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
         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="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>
   <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

我该怎么做才能解决这个问题?

解决方法

基本上,错误意味着您的一个子文件夹中有一个web.config文件,该文件具有不应具有的配置元素.这是你的root / only web配置文件吗?如果没有,你也可以发布这些吗?

此外,它听起来很愚蠢,但我会仔细检查你在IDE中打开网站本身(而不是错误地打开父文件夹)我看到人们花了几个小时尝试调试同样的错误,当他们一直在不在正确的目录中.

以下是关于如何为ASP设置web.config层次结构的一个很好的解释,它将帮助您可视化其工作原理:http://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读