We just recently upgraded from VS2008 to VS2010.
Our project compiles fine; but when we go to run the Web Application, we get the following error when opening Default.aspx:
Server Error in '/' Application.
Compilation Error Description: An
error occurred during the compilation
of a resource required to service this
request. Please review the following
specific error details and modify your
source code appropriately.
Compiler Error Message: CS0246: The
type or namespace name 'var' could not
be found (are you missing a using
directive or an assembly reference?)
Opening up the page, and mousing over the 'var' declaration, VS2010 correctly recognizes that it's type is a RegEx.
I'm thinking something funky might have happened in either our web.config or machine.config during the upgrade.
Anybody else run into this problem before? Any help would be greatly appreciated, hopefully it can save me some time diving into these files.
EDIT:
Here's the relevent section of code that's blowing up:
Line 10: protected void valSearchFreeText_ServerValidate(object source, ServerValidateEventArgs args)
Line 11: {
Line 12: var url = new Regex(#"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase);
Line 13: var html = new Regex(#"[<,>]", RegexOptions.IgnoreCase);
Line 14: args.IsValid = !html.IsMatch(args.Value) && !url.IsMatch(args.Value);
I don't believe that .NET 4.0 is the cause; we only upgraded from VS2008 to VS2010; we did not migrate from .NET 3.5 to .NET 4.0
I will double check on the ASP.NET Development Server vs. IIS and post back in a few minutes with the results from that. It's definitely being thrown from the Development Server.
Edit 2
This is being thrown from both the Development Server, and IIS.
System.Xml.Linq is also included in the assemblies section of our web.config:
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Check your web.config file for the configuration/system.codedom/compilers/compiler node. There should be a providerOption child node that determines the compiler version to be used. It ought to look like <providerOption name="CompilerVersion" value="v3.5"/>. It sounds like yours says 2.0 instead of 3.5.
Is the associated application pool in IIS set to use the .Net 4 framework?
Ensure that the target framework is set to 3.5 or higher
Also, double check that you have a good web.config file in the Application root folder (copy the recommended web.config and rename it.)
Related
I am attempting to use AddictedCS SoundFingerprinting (https://github.com/AddictedCS/soundfingerprinting).
When I download any recent version and build with Visual Studio 2019 I get the expected output with no errors or warnings (SoundFingerprinting.dll).
The issue is that when I attempt to call functionality from the DLL in a .net console application I get errors relating to netstandard referencing.
I've attempted to add a new reference manually as the error message suggests, but get no further - same error occurs.
Here is my code, taken straight from the SoundFingerprinting example:
var hashedFingerprints = await FingerprintCommandBuilder.Instance
.BuildFingerprintCommand()
.From("C:/Users/Asher/Desktop/testSound.wav")
.UsingServices(audioService)
.Hash();
Here is the error log I am getting when compiling my console app with either mcs or csc:
C:\Users\Asher\Desktop\Raw_0.1>mcs TestProg.cs
-r:SoundFingerprinting.dll -r:protobuf-net.dll TestProg.cs(46,40): error CS0012: The type System.Object' is defined in an assembly that
is not referenced. Consider adding a reference to assembly
netstandard, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'
C:\Users\Asher\Desktop\Raw_0.1\SoundFingerprinting.dll (Location of
the symbol related to previous error) Compilation failed: 1 error(s),
0 warnings
I attempted this on my desktop PC running Windows 10, and on my Surface Pro 6 running Windows 10. I also attempted this using VS2017. The result was the same each time.
Also tried to use the library in Unity3D which caused a crash with no prompt or stacktrace output.
To Reproduce
Use: Windows 10, Visual Studio 2019
Steps to reproduce the behavior:
Download latest release (v7.2.0-beta3)
Build libraries
Attempt to call functionality from SoundFingerprinting.dll via a console application
I encountered exactly the same problem today. What fixed it for me was simply downloading the latest version of protobuf-net from nuget:
Install-Package protobuf-net -Version 3.0.101
Also, please don't paste pictures of code but the code itself next time.
I've just created a new API using ASP.NET Core 2.0.
I haven't coded anything yet. I just want to test the initial API template.
When I try to start my project I receive the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
I do not receive any errors when building the project.
The assemby can be found at the following directory: 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.hosting.abstractions\2.0.2'.
Is that correct? Where should the 'Microsoft.AspNetCore.Hosting.Abstractions' assembly be located and why can't VS find it?
I had the same error attempting to debug a simple Azure Function App (this is using .NET core) created from the Function App template in Visual Studio 2017. Attempting to run in debugger gave me the same error. It turned out to be I had updated the Microsoft.NET.Sdk.Functions package from version 1.0.6 to 1.0.12. That was my problem. Reverted the update back to 1.0.6 and it worked fine. Hope this helps!
Please re-install the nuget package or upgrade to the latest at: https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Abstractions/
An ASP.NET/C# project which I created in 2003 has been running on a university server for over 10 years now but I was just informed that the server crashed and they are trying to set everything up again.
They are getting the following error.
I see that at the bottom it seems that they have installed Mono on a Debian machine. Could it be that they installed Mono but forgot to install the C# compiler, or does this message imply something else is wrong?
What could be the cause and solution to this error?
According to the BuildManager code in Mono:
if (configSection == null)
config = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
else
config = configSection;
...
if (throwOnMissing)
throw new HttpException (String.Concat ("No compiler for language '", language, "'."));
It's apparently not finding the compilation section for C# in the configuration. Have you checked the machine.config or web.config? e.g.
<system.web>
<compilation defaultLanguage="C#">
<compilers>
You should have a .NET compiler configuration here.
</compilers>
</compilation>
</system.web>
Check out this page for more information.
it could be also an decode error because he can identify '\C#\' try to use dos2unix rekursivly over your directory
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
unrecognized attribute ‘targetframework’
I'm trying to use SocialAuth.NET for extract contacts from gmail and yahoo for my web application but when I run the WebformDemo the following error occurs
Server Error in '/Demo' Application.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note
that attribute names are case-sensitive.
Source Error:
Line 76: </authentication>-->
Line 77: <!--<authentication mode="None"/>-->
Line 78: <compilation debug="true" targetFramework="4.0">
Line 79: <assemblies>
Line 80: <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Source File: D:\test\SocialAuth-net-2.3\WebFormsDemo\web.config
Line: 78
Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
ASP.NET Version:2.0.50727.3053
I'm using Windows XP and Visual Studio 2010.
Any help?
sorry guys I realized my mistake.The problem is I didnt change the asp.net version in IIS..If any one suffer with the same problem go through the following steps
step 1. run-> inetmgr
step 2.create a virtual folder for your directory (http://code.google.com/p/socialauth-net/wiki/Quickstart_Guide)
step 3. right click on your virtual directory then click properties and select asp.net tab and change version to 4.0
I have an ASP.NET 3.5 web application which works perfectly fine on my local machine and when I deploy it on my Windows 2008 server. I am getting the following javascript error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0
URI: http://localhost/ScriptResource.axd?d=e1Gld4LGHLsC4rWqevEI8zAMJKoVcCEVHBjdJIxcQLO9of6t7nNopbI1YyxJTv1QbaxN_lTSoz5Ly-VjBRHp08Mf3xxg5V9i5Z0AiXIkZRY1&t=6af1de90
I have a utility which can decrypt the URI and tell exactly what file is missing and it tunrns out that the file is ZSystem.Web.Extensions,3.5.0.0,,31bf3856ad364e35|MicrosoftAjax.debug.js|. Why am I not able to load this js file? Any help?
Possible options:
You've not installed .NET Framework SP1 on your server, so it can't find the 3.5 assemblies to generate the MsAjax file.
You've deployed your web.config file with <compilation debug="true"> while IIS has been configured to compile it in release mode.
I have run into a similar problem before when the development and production machines are set for two different time zones. When ASP.NET AJAX tries to load a script resource from an assembly, the last modified date/time of the assembly is validated. If the local time of the production server is "earlier" than the last modified date/time of the assembly, then an ArgumentOutOfRange exception is generated by ASP.NET AJAX when processing the request.
Really difficult to debug since the problem eventually resolves itself.
I suppose this might be possible with a System assembly if Copy-Local is set to true.
I was using some third party web services and the problem was with the following xml tag in the web.config:
<extendedProtectionPolicy policyEnforcement="Never" />
Once I removed this tag the error went away