ASP.NET 4.0 runtime error on first loading of page - asp.net

I newly converted my solution to .NET Framework 4.0
After it I got very wired error. Each first load after building my app I get filenotfound exception. here it is:
Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 9:
Line 10:
Line 11:
Line 12:
Line 13:

Change in your web.config file
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="Off"/>
<authentication mode="None"/>
</system.web>

Check if every mdule that you use on web.config is version 4. I think that you have miss a version 2.0 of the System.Windows, or a similar.
Especial Check this entries.
<compilation targetFramework="4.0">
<assemblies>

It happened to me something similar. I had a reference to an assembly in the web.config file and I was missing the ddl file in the project references folder. Try reference this assembly (System.Windows). Also you can check if the referenced version of the ddl has matching version with the one specified in the web.config (Version=2.0.5.0).

Since you said you've recently converted your app to .NET 4.0, please check the .NET version of your app's Application Pool in IIS. If it's 2.0 change to 4.0. Also check if you have properly referenced all your assemblies in your server.

Related

Configuration Error on web host ,Could not load file or assembly

Please i want to solve this problem i did .aspx web application and when i try to publish it by GearHost i face this problem
Server Error in '/' 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: Could not load file or assembly 'MySql.Data, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Source File: C:\home\site\wwwroot\web.config Line: 14
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3429.0
and my web.config is
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="MySql.Data, Version=8.0.18.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Please can anyone help me

Unrecognized attribute 'targetFramework' error

I have deployed my websitete using filezilla client. But i encounter the following problem.
Collapse | Copy Code
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 6: <configuration>
Line 7: <system.web>
Line 8: <compilation debug="true" targetframework="4.0">
Line 9: <assemblies>
Line 10: <add assembly="sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /></assemblies></compilation>
Source File: C:\Inetpub\vhosts\dhuvara.com\httpdocs\sub\asp\web.config Line: 8
I red all the error details regarding this error. everything says that change the framework to 4.0. but actually i am using framework 4.0. i dont know to how to solve it?
Default framework of your webserver may be 2.0 or something.
If you have access to your IIS web server, please check the target framework of the application pool. Change the target framework of the application pool of your website to 4.xxxx.

Publishing website on IIS error

Hi everyone when i publish my website via IIS, I get this error code as you can see at below. Can you help me ?
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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 27: </assemblies>
Line 28: </compilation>
Line 29: <authentication mode="Forms">
Line 30: <forms loginUrl="~/Account/LogOn" timeout="2880" />
Line 31: </authentication>
Source File: C:\Users\furkan\Desktop\WebCity\webcity\web.config Line: 29
Then I converted my root dictionary to Application but I get this error
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 17: <system.web>
Line 18: <httpRuntime requestValidationMode="2.0" />
Line 19: <compilation debug="true" targetFramework="4.0">
Line 20: <assemblies>
Line 21: <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Source File: C:\Users\furkan\Desktop\WebCity\WebCity\web.config Line: 19
The answer to the first issue was this:
This usually means you have not configured the directory for your website as an application. Open up IIS Manager, find the root directory for your website (where web.config is), right click, and select "Convert to Application".
For the new issue, it's a problem of the .NET version. You either don't have asp.net 4.0 installed, or you have the application pool set to use the wrong framework. It's probably the latter, so go to the advanced setting for your site, select the Application Pool setting, and choose an Application Pool called ASP.NET 4.0, or any other that uses the 4.0 framework. If there aren't any, then you need to install .NET 4.0
Did you check if you have multiple web.configs in a sub directory somewhere?
Link describing the problem here

Error with <add assembly="System.Data.SqlClient, Version=10.50.1600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Why do I get this error? How I can fix it? I'm connecting from Web.config in an application that I started to do but I finish school issues because it is a team effort. The teacher has told me I should put that online so that my connection is well made ​​but not if publicToken or something else this evil at the time of writing the line is enclosed in asterisks. I need to indicate that I am writing wrong Please will thank you.
Server Error in '/' Application.
Configuration Error
Description: Error during processing of a configuration file required to service this request. Check the specific error details below and modify your configuration file accordingly.
Parser Error Message: Could not load file or assembly 'System.Data.SqlClient, Version = 10.50.1600, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'or one of its dependencies. The system can not find the file specified.
Source Error:
Line 51: <add assembly="System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 52: <add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 53: **<add assembly="System.Data.SqlClient, Version=10.50.1600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>**
In .NET there is no such assembly as System.Data.SqlClient, Version=10.50.1600, .... SqlClient is the part of standart .NET Framework distribution.
For example, System.Data.SqlClient.SqlConnection:
Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
How to determine fully qualified assembly name
Download the previous, free version of .NET Reflector, load assembly into (simply drag it onto) and you will see it's FQN
Have you checked to make sure that the dll indicated is being deployed and that the version number matches the version you specify above? The error is pretty clear. The system can't find the assembly that the code refers to on this line.
Well, you can browse the GAC (Global Assembly Cache) for meet the assembly data. Use the following command from de command prompt :
gacutil -l
This list the content of the GAC with the information that you need.

asp.net Compilation Error (mysql.data)

i have an error when trying to start default.aspx.
Compiler Error Message: CS0433: The type 'MySql.Data.MySqlClient.MySqlConnection' exists in both
'c:\Windows\assembly\GAC_MSIL\MySql.Data\6.3.6.0__c5687fc88969c44d\MySql.Data.dll' and 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\elwazefa\fd12d8de\3446c68c\assembly`\dl3\dc121b8b\00d6e0c3_62aacb01\MySql.Data.CF.DLL'`
i am using asp.net 3.5
what is the problem, thanks
It looks to me like you have references to both the Compact Framework and the standard framework MySQL libraries in your project. You need to remove the references to the ones that have .CF in their filename.
Check your web.config file assemblies section for multiple references:
<compilation>
<assemblies>
...
</assemblies>
</compilation>
If there is more than one then remove it (the one not in the GAC, I would say off-hand.)
Also, as #Abe suggests, delete the temporary files under the following path:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\

Resources