website compile error - asp.net

I am experiencing the following error while loading a website:
Server Error in '/DatingGridView' 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 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 52:
Line 53:
Line 54:
Line 55:
Line 56:
Source File: D:\VSProjects\DatingGridView\web.config Line: 54
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information ===
LOG: User = PassionFruit-PC\PassionFruit!!!
LOG: DisplayName = System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///D:/VSProjects/DatingGridView/
LOG: Initial PrivatePath = D:\VSProjects\DatingGridView\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\VSProjects\DatingGridView\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions/System.Web.Extensions.EXE.
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

Your error clearly states:
Could not load file or assembly 'System.Web.Extensions'
Check that you are referencing this in your project and that your .NET framework is installed correctly.

System.Web.Extensions is required for MS Ajax and will appear in your D:\VSProjects\DatingGridView\web.config to enable the correct handlers for ASP.Net 2.0 (comes built in for 3.5). If you haven't installed the MS Ajax Extensions on the machine where you are running this site you'll have the kind of error you've posted.

Related

Cannot load file or assembly 'System.Runtime'

I have an Asp.Net 4.7 WebForms legacy application written in vb.net. To add Azure B2C authentication, I add OWIN middleware NuGet packages like this:
Install-Package Microsoft.Owin.Security.OpenIdConnect
Install-Package Microsoft.Owin.Security.Cookies
Install-Package Microsoft.Owin.Host.SystemWeb
based on this tutorial: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-asp-webapp
When I try to run the application, I get this error:
Could not load file or assembly 'System.Runtime, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified.
Here is the log:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=...
(Fully-specified)
LOG: Appbase = file:///C:/Git Repos/InfoWeb/
LOG: Initial PrivatePath = C:\Git Repos\InfoWeb\bin
Calling assembly : System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=....
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Git Repos\InfoWeb\web.config
LOG: Using host configuration file: C:\Users\dreznik\OneDrive - MyCompany\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.0 redirected to 4.1.1.0.
LOG: Post-policy reference: System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=...
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/vs/17153f21/a2ffde83/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/vs/17153f21/a2ffde83/System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Git Repos/InfoWeb/bin/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Git Repos/InfoWeb/bin/System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/vs/17153f21/a2ffde83/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/vs/17153f21/a2ffde83/System.Runtime/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Git Repos/InfoWeb/bin/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Git Repos/InfoWeb/bin/System.Runtime/System.Runtime.EXE.
How can this be resolved? I have already tried to delete temporary Asp.Net files.
You must check that assemblyBinding subsection inside runtime section of web.config file have correct value that define System.Runtime.
It must be something like this
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0-4.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime

Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0 when using Atlassian.SDK 10.6.0

My project is using Nuget package Atlassian.SDK 10.6.0.
When calling
var jc = Atlassian.Jira.Jira.CreateRestClient(_jiraBaseUrl, _jiraApiUsername, _jiraApiPassword);
I have the error
System.IO.FileLoadException: Could not load file or assembly
'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
My web.config already has the bindingRedirect
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>
I also checked the fusion log
Calling assembly : Atlassian.Jira, Version=10.6.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: F:\Titan\AutoLedgers\Facade\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/facade/a6115f90/89f913a7/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET
Files/facade/a6115f90/89f913a7/Newtonsoft.Json/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///F:/Titan/AutoLedgers/Facade/bin/Newtonsoft.Json.DLL.
LOG: Assembly download was successful. Attempting setup of file: F:\Titan\AutoLedgers\Facade\bin\Newtonsoft.Json.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I really have no idea how can I resolve this issue now. Does anyone has any idea?

ASP.Net Razor App - OAuth somehow got into app, can't get it out

Sounds strange, I know... and I've poured over every post I could find relating to this :( However, my website worked just fine and then all of the sudden it is failing on:
Could not load file or assembly 'DotNetOpenAuth.Core, Version 4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the asembly reference. (Exception from HResult: 0x80131040).
I don't see any references to it at all in the project and it has never used authentication ever. What is the lowest level I can get to in order to find out where it is trying to call this assembly and remove it?
It's frustrating as heck... I know it is because I'm not an every-day programmer - so maybe its easy to find, but I have looked over hundreds of posts here and elsewhere trying to resolve and nothing has worked so far :(
I also grabbed an unused reference tool called ResolveUR to try to do it... still same result :(
FYI - I'm using Visual Studio 2013 for this one because Installshield LE is part of it and that was how the application was initially deployed.
Thanks in advance!
** ADDED error I get from page **
=== Pre-bind state information ===
LOG: DisplayName = DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
(Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/MedsAdmin/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\MedsAdmin\bin
Calling assembly : Microsoft.Web.WebPages.OAuth, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/medsadmin/4efeacc2/d291dc53/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/medsadmin/4efeacc2/d291dc53/DotNetOpenAuth.Core/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MedsAdmin/bin/DotNetOpenAuth.Core.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
* EDIT: Replaced Old Web.Config *
Somehow my web.config file got written over - so that is the reason for the OpenAuth issue.
NOW: It seems to be trying to load MySQLMembershipProvider from my machine.config file (which fails). Why is it doing this?

Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

I downloaded the web app from my company's server and running it on my machine. It works well except when I click on one of the menu items (all the others are good). It is showing me this error. I checked my web.config and the version I set for web.mvc is 4.0.0.0. I have no idea how is this happen.
I checked the similar problem on the websites but the solutions are not working for me. Here is the assembly load trace info that might be helpful:
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///%working root%/WebApplication/
LOG: Initial PrivatePath = %working root%\WebApplication\bin
Calling assembly : App_Web_e4sj14ak, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: %working root%\WebApplication\web.config
LOG: Using host configuration file: C:\Users\Kevin\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/Kevin/AppData/Local/Temp/Temporary ASP.NET Files/root/57d1caa4/e98fbd78/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Users/Kevin/AppData/Local/Temp/Temporary ASP.NET Files/root/57d1caa4/e98fbd78/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///%working root%/WebApplication/bin/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///%working root%/WebApplication/bin/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Users/Kevin/AppData/Local/Temp/Temporary ASP.NET Files/root/57d1caa4/e98fbd78/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///C:/Users/Kevin/AppData/Local/Temp/Temporary ASP.NET Files/root/57d1caa4/e98fbd78/System.Web.Mvc/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///%working root%/WebApplication/bin/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///%working root%/WebApplication/bin/System.Web.Mvc/System.Web.Mvc.EXE.
I am really confused that I am using MVC4 but the error message is version of 3.0.0.0. This problem has annoyed me for a long time. Please help me and thanks in advance.
Problem solved by installing MVC 3.0 in my computer. Now it's working.
On your web.config, be sure to have this inside assemblyBinding section
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
It forces to use 4.0.0.0 no matter what assembly version is trying to bind

Why can't I encrypt web.config/appSettings using a custom configProtectionProvider on Azure (Windows Server 2012)?

I have an MVC application which is deployed to a Windows Azure hosted service running on a Windows Server 2012 virtual machine. In the web.config file, I have 3 sections encrypted using the PKCS12ProtectedConfigurationProvider: connectionStrings, dataCacheClients, and system.net/mailSettings/smtp. Here is what the relevant sections look like:
<configuration>
...
<configProtectedData>
<providers>
<add name="CustomProvider" thumbprint="[this is secret]"
type="Pkcs12ProtectedConfigurationProvider.Pkcs12ProtectedConfigurationProvider, PKCS12ProtectedConfigurationProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=34da007ac91f901d" />
</providers>
</configProtectedData>
...
<connectionStrings configProtectionProvider="CustomProvider">
<EncryptedData ... ommitted for brevity
</connectionStrings>
...
<system.net>
<mailSettings>
<smtp configProtectionProvider="CustomProvider">
<EncryptedData ommitted for brevity
</smtp>
</mailSettings>
</system.net>
...
<dataCacheClients configProtectionProvider="CustomProvider">
<EncryptedData ommitted for brevity
</dataCacheClients>
...
</configuration>
All of the above works perfectly fine. When deployed to Azure, the connection strings, SMTP mail, and data cache all work. The PKCS12ProtectedConfiguration provider uses my custom certificate to decrypt the sections and all is well.
However I can't seem to use the same approach to encrypt web.config/appSettings. When I try deploying something like the following to Azure...
<configuration>
...
<appSettings configProtectionProvider="CustomProvider">
<EncryptedData ommitted for brevity
</appSettings>
...
</configuration>
...then I get the following exception:
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: An error occurred loading a configuration file: Could not
load file or assembly 'PKCS12ProtectedConfigurationProvider, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=34da007ac91f901d' or one of its dependencies.
The system cannot find the file specified.
Source Error:
Line 41: </EncryptedData>
Line 42: </connectionStrings>
Line 43: <appSettings configProtectionProvider="CustomProvider">
Line 44: <EncryptedData ...>
Line 45: <EncryptionMethod .../>
Source File: E:\sitesroot\0\web.config Line: 43
Assembly Load Trace: The following information can be helpful to determine why
the assembly 'PKCS12ProtectedConfigurationProvider, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=34da007ac91f901d' 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].
However I know the PKCS12ProtectedConfigurationProvider.dll is in the /bin folder because:
I remoted into the VM and saw it in both approot/bin and siteroot/bin
When I deploy with the appSettings unencrypted, the other 3 sections are successfully decrypted using this dll.
It's almost as if the assembly loader can't look for the PKCS12ProtectedConfigurationProvider.dll file until after it parses and loads the appSettings section. I have tried omitting the Version, Culture, and PublicKeyToken parts of the provider config section, but then the error just changes to this:
Parser Error Message: An error occurred loading a configuration file: Could not
load file or assembly 'PKCS12ProtectedConfigurationProvider' or one of its
dependencies. The system cannot find the file specified.
Is it possible to encrypt web.config/appSettings using a custom configProtectionProvider when deploying to a Windows Azure hosted service running on a Windows Server 2012 virtual machine? If so, what am I missing here?
Update:
After posting this I turned on the Fusion!EnableLog registry key and now I get this additional information in the exception:
Assembly Load Trace: The following information can be helpful to determine why
the assembly 'PKCS12ProtectedConfigurationProvider, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=34da007ac91f901d' could not be loaded.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = PKCS12ProtectedConfigurationProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=34da007ac91f901d
(Fully-specified)
LOG: Appbase = file:///d:/windows/system32/inetsrv/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: D:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from D:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: PKCS12ProtectedConfigurationProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=34da007ac91f901d
LOG: Attempting download of new URL file:///d:/windows/system32/inetsrv/PKCS12ProtectedConfigurationProvider.DLL.
LOG: Attempting download of new URL file:///d:/windows/system32/inetsrv/PKCS12ProtectedConfigurationProvider/PKCS12ProtectedConfigurationProvider.DLL.
LOG: Attempting download of new URL file:///d:/windows/system32/inetsrv/PKCS12ProtectedConfigurationProvider.EXE.
LOG: Attempting download of new URL file:///d:/windows/system32/inetsrv/PKCS12ProtectedConfigurationProvider/PKCS12ProtectedConfigurationProvider.EXE.
So here's another question: Why is IIS looking in the inetsrv path for this assembly instead of looking for it in the app's /bin folder? I see in the log "No application configuration file found." Does this mean the assembly binder has to find a web.config with an unencrypted appSettings section in order to parse and load it?
Did you attempt installing the assembly in the GAC yet on role start?
Information on adding assemblies to the gac on start up http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/
I was able to fix this error by installing the NuGet package: https://www.nuget.org/packages/Pkcs12ProtectedConfigurationProvider/
I'm guessing part of the install process is registering the .dll for you.

Resources