2014-01-17 163 views
0

我一直在尝试做一个项目,但是在web.config中,它一直给我错误,认为它不能识别属性TargetFramework。ASP.NET TargetFramework属性不被识别

编辑:添加了web.config。我看到了一个问题,他们说那个问题应该与ASP.NET版本相同。但我真的不知道该怎么做。

P.S.我不能更改为不同版本的Visual Studio(我使用该程序),因为它不会允许我在本地Web上运行文件。但这是一个不同的问题。

已经有一段时间了。猜猜这是一个棘手的问题。

<?xml version="1.0"?> 
<!-- 
Note: As an alternative to hand editing this file you can use the 
web admin tool to configure settings for your application. Use 
the Website->Asp.Net Configuration option in Visual Studio. 
A full list of settings and comments can be found in 
machine.config.comments usually located in 
\Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 
<appSettings/> 
<connectionStrings/> 
<system.web> 
    <!-- 
     Set compilation debug="true" to insert debugging 
     symbols into the compiled page. Because this 
     affects performance, set this value to true only 
     during development. 
    --> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 



      </assemblies> 
    </compilation> 
    <!-- 
     The <authentication> section enables configuration 
     of the security authentication mode used by 
     ASP.NET to identify an incoming user. 
    --> 
    <authentication mode="Windows"/> 
    <!-- 
     The <customErrors> section enables configuration 
     of what to do if/when an unhandled error occurs 
     during the execution of a request. Specifically, 
     it enables developers to configure html error pages 
     to be displayed in place of a error stack trace. 

    <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> 
<system.codedom> 
</system.codedom> 
<!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet 
    Information Services 7.0. It is not necessary for previous version of IIS. 
--> 
<system.webServer> 
</system.webServer> 
</configuration> 
+1

你可以发布你的配置文件有这一行的部分? –

+0

错误的asp.net版本 - 您可能使用了一些不属于您运行的asp.net版本的属性。 – Aristos

回答

3

这种情况基本上发生在web.config中的targetFramework =“4.0”属性中,但App Pool设置为运行ASP.NET 2.0。 targetFramework属性完全无法被ASP.NET 2.0识别 - 这意味着即使您在配置文件中将其更改为2.0,它也不起作用。

如果您的应用程序在4.0编码,则程序池是需要被设置为4.0 在IIS>右键单击网站>属性> ASP.NET>版>“应改为4.0.21006”不是2.0

0

当试图在Visual Studio中使用Fortify时,我得到了这个错误。 Visual Studio Fortify插件似乎想要使用aspnet_compiler而不是msbuild。它正在抛出确切的消息。

当我使用命令行工具Fortify编译使用msbuild时,它工作。也许你的Visual Studio没有使用msbuild?如果还没有,可以尝试将其转换为Web应用程序。我认为Visual Studio默认会使用MSBuild。不知道这是你的问题,但我确实得到了完全相同的错误信息。祝你好运。

相关问题