Conflicting versions of ASP.NET Web Pages detected - asp.net

I'm receiving the following error when I run my ASP.NET web project:
Conflicting versions of ASP.NET Web Pages detected: specified version is "2.0.0.0", but the version in bin is "3.0.0.0". To continue, remove files from the application's bin directory or remove the version specification in web.config.
The answer on this question solves this problem - in my Web.config, switching
<add key="webpages:Version" value="2.0.0.0"/>
to
<add key="webpages:Version" value="3.0.0.0"/>
allows me to successfully run my site.
Unfortunately, a coworker who recently pulled down a clean copy of the repository is receiving the exact opposite error:
Conflicting versions of ASP.NET Web Pages detected: specified version is "3.0.0.0", but the version in bin is "2.0.0.0".
He can solve the problem by changing the webpages:Version value back to "2.0.0.0".
What is the root cause of this error, and how can my coworker and I use the same version in our Web.config?

Related

IIS error 500.19 error when reading web.config

I am running IIS under Windows Server 2016 and I'm trying to run an ASP.Net core 3.1 application but I can't get past this error:
500.19 error
(The language in the picture is Hungarian, but it contains no useful information whatsoever, just an example)
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Minibizz.Routing.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
What am I missing?
P.S.: The web.config was created by Visual Studio 2019.
The reason behind the issue:
That error message goes on to say what exactly is bad about your configuration file, hence you should refer the “Config Error” and “Config Source” sections. This problem occurs because of the ApplicationHost.config file or the Web.config file contains a malformed or unsupported XML element.
if you are using url rewrite rule then install url rewrite Extention of iis. Enable ANCM logging, ie. set stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout\" (I think the path needs to end by a backslash), then run the web app and see if something gets logged into the stdout folder. Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the "logs" directory in the root folder of the deployed site. Verify that the application pool has to write access to the logs directory.
Make sure you installed the .net bundle.check that you installed below iis feature:
You may also need to verify that the path to the dotnet executable exists in the deployment machine's environment variables. To check this, first find the path where dotnet.exe is installed. It is generally located in either C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. Once you know the path, ensure that the path exists in your Environment Variables.
The web.config content seems to be correct. If you use a clean web.config copy, does the problem persist? If the issue can be solved by replacing web.config with clean configuration content, then the problem is exactly with this web.config. In this case, I suggest you remove parts of the web.config content to narrow down the issue. If the pages show correctly after you remove one section, then the problem is with that section. You need double-check what's wrong with the section and update the correct configuration.
If the problem remains even with clean web.config content, I suggest you access other pages in different folders in your site to see if the problem still exists.
you could refer this below link for how to publish asp.net core site in iis:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio

Dependency on the framework assembly "System.Runtime, Version=4.0.10.0," which could not be resolved in the currently targeted framework

TFS 2013 - Build: ASP.Net 4.5.1 website I get this error:
warning MSB3268: The primary reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll"
could not be resolved because it has an indirect dependency on the framework assembly
"System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which
could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.1". To resolve this problem, either remove the reference
"C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll" or retarget your application to a framework
version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
All projects and site was 4.0 initially using Unity 1.0.0.0. I upgraded it to 4.5.2. Also the MyProj1 in the error above is referencing Unity and I upgraded it to 3.5.1 as well.
Read this: https://unity.codeplex.com/workitem/12756
The build server already have the updated 4.5.2 pointed in the workaround.
So I downgraded to 4.5.1 but still getting the error.
Solution builds fine locally via Visual studio 2013.
The stand alone class libraries project build in TFS fine but when MyProj is added as a reference to my Website, that's when it fails.
Any ideas?
Do I need any web.config changes other than TragetFramework settign while upgrading?
I had to upgrade my Unity to 3.5 due to my project's dependency on some other project and this error came again. This time, finally got it fixed.
This one helped me: http://devsilos.blogspot.com/2014/10/msb3268-while-targeting-aspnet-web-site.html
Solution I copied all the files that build was complaining about from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades
To
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2
Here's the explanation from the link above in case it goes down for any reason in future:
A deeper inspection revealed the following interesting fact:
aspnet_compiler for some reason does not take into account the .dll-s
that reside under the Facade directory of 4.5 assemblies (C:\Program
Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades). It looks
only under C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.5
As a result the whole thing failed since both System.Threading.Tasks
and System.Runtime .dll-s were under the Facades directory and not
inside the v4.5.
Now the solutions:
Just simply copy the missing .dll-s from Facade to the v4.5
directory.
Set the TargetFrameworkMoniker to 4.5.1 in the .sln file. The exact
syntax is as follows: TargetFrameworkMoniker =
".NETFramework,Version%3Dv4.5.1".
What happens in this case is that the aspnet_compiler does not
recognize the exact version of the required framework and tries to
use the GAC wherever it can. If 4.5 is the highest version installed
on the build machine I believe it should work.
Actually sorry I don't think "assemblyBinding" would help.
It seems like a known bug. It has not been resolved. Using Unity 3.5 you can target .NET 4.5.1 but not 4.5.2.
So one option would be to re-target to .NET 4.5.1 and see if the problem goes away, if that's an option.
p.s.
Also you can try .NET Framework 4.5.2 Developer Pack. But some have mentioned it did not work.
We recently ran into a similar problem with a site that was upgraded to target .NET 4.5, and initially followed the solution in gbs's answer.
In our case, we had several warnings following this pattern:
<project name>.metaproj : warning MSB3268: The primary reference "<project reference>.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5". To resolve this problem, either remove the reference "<project reference>.dll" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
We then discovered that if you create a new web site targeting 4.5.x (File > New > Web Site...) and select the ASP.NET Empty Web Site template, the package Microsoft.Net.Compilers is included. Adding this package to our site resolved the issue without the need to touch the reference assemblies.
Of the original two solutions, copying the files caused the build to succeed but presented maintenance concerns, and changing the TargetFrameworkMoniker (to 4.5.3 rather than 4.5.1) produced a different build error and was a brittle solution.

asp server error ' Could not load file or assembly ' but the assembly is definitely there.

I am currently getting the following error. On a locahost website.
Could not load file or assembly 'MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Though, the reference is definitely there in the references folder and that dll is definitely on my local machine in the place it is pointing to. I have also tried deleting and re-adding the reference.
Does anyone know what would cause this error?
Also what is the assemblys manifest definition?
Thanks in advance for the help, I very much appreciate it.
in visual studio select the reference in the solution explorer then in the properties make sure the Specific Version property is set to false.
If you have an entry for this reference in the web.config, edit the file and remove the version information.
if you close visual studio and open the project file with a text editor, make sure in the project file the version of the assembly is not listed but only the name and type, so just remove the following:
, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'
then it should work no matter if you are using the 6.5.5 or 6.5.4, as long as the code is using classes and methods available in both.
I have experienced the same situation and managed to fix the problem with these steps,
Read the error information carefully which provides helpful details to rectify the situation.
I wouldn't change the machine.config file.
As it says Application cannot find a reference to the assembly MySql.Web and the version it is trying to reference is Version=6.7.4.0.
Based on path you install MySql you will be able to find the correct assembly files, ex :
C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Data.dll
Copy that file to bin folder. (I would copy all the files in C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\ folder to bin folder)
Hope this helps! Thanks
I have encounter the same problem very few days ago , you get this error when you have build your some DLL with earlier version and now you have change the dependent DLL version but had not build the DLL again . Please check if you have any component which was build on the earlier version . While we build any DLL , DLL it self in the manifest add all the dependency information so that it can load all of them when required . So if you remove that version of DLL you need to recompile all the component and then use
This problem persists also in newer version of MySql.Data. Just change the version from App.config file:
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.6.5.0" newVersion="6.6.5.0" />6.7.4.0
to oldVersion="6.6.5.0"
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="6.6.5.0" newVersion="6.7.4.0" />
I had this in an older asp.net 2.0 website on a new machine. In my case, the MySql assembly from the GAC could not be loaded because it was .Net 4.0. Assembly redirect in web.config did not work. I fixed it as follows:
Download the specific version of MySql.Web and MySql.Data from nuget:
https://www.nuget.org/api/v2/package/MySql.Web/6.5.4
https://www.nuget.org/api/v2/package/MySql.Data/6.5.4
Open the downloaded packages with a zip tool (e.g., 7zip) and extract the .Net 2.0 assemblies into the bin directory of the malfunctioning asp.net site.
I was getting the same error and the file absolutely existed.
If you see a SGEN next to your error, you can try this:
In the project properties window go to Build and in the Output section go to the Generate serialization assembly dropdown. Change the value Auto to Off and Build again.
You can set it back to auto if you need it.
In some situations, it depends on bindingRedirect attributes in web.config file of the project. In my case, I had two version: olderVersion and newVersion. I just switched those values and it solves the problem.
WARNING: Be sure that the newer version is referenced into web.config assemblies' tag file just as :
<add assembly="$AssemblyName", Version=$NewVersion, Culture=neutral, PublicKeyToken=$KeyToken/>

Crystal Report Engine RunTime Error

Hello,
I convert the project visual studio & the crystal reports to Version 10
but the server has the old version so i have to add the old references
IT show the report but i'm having a problem on printing and engine issue
Crystal Report Bar Engine :
Server message :
Local message :
Server Error in '/' Application.
--------------------------------------------------------------------------------
HTTP Error 404 - Not Found.
--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 10.0.0.0
Tried :
-- Re install the Crystal Report 10 .
-- Delete all Crystal Report references and add it again .
-- Clean the Solution , remove the references and add it again .
(~ latest result (current status):
I realized that i have install CRforVS_13_0_2 that have the package CRRuntime_64bit_13_0_2.msi and my computer is 32-bit operating system .. so i install CRRuntime_32bit_13_0_2.msi and it finished the installation unlike CRRuntime_64bit_13_0_2.msi .. but the problem with Business Objects still there as it shown in the "Crystal Report Bar Engine " image . ~)
Note : If i add the new references of crystal report ,it sure work on the local but not on
the server . So i have to work with the old references.
HELP .
Analyze the problem
It's possible to analyze the problem, and find a 403 (Forbidden) error
using client tools (debug window of browser)
GET http://someServer:20080/aspnet_client/system_web/4_0_30319/crystalreportviewers13/js/crviewer/crv.js 403 (Forbidden)
GET http://someServer:20080/aspnet_client/system_web/4_0_30319/crystalreportviewers13/js/crviewer/images/style.css 403 (Forbidden)
or server tool (IIS log , on WIN2003 is placed in %SYSTEMROOT%\System32\LogFiles\W3SVC###\).
2011-03-28 13:00:49 W3SVC701536 95.228.38.41 GET /aspnet_client/system_web/4_0_30319/crystalreportviewers13/js/crviewer/images/style.css - 20080 - 192.168.1.2 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+Trident/5.0) 403 6 64 Errore!
2011-03-28 13:00:49 W3SVC701536 95.228.38.41 GET /aspnet_client/system_web/4_0_30319/crystalreportviewers13/js/crviewer/crv.js - 20080 - 192.168.1.2 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+Trident/5.0) 403 6 64 Errore!
Cause the problem
In both cases i found that crv.js and style.css some files were not served;
these files are placed by CR installer in wwwroot\aspnet_client folder, but for some reasons they cannot be reached;
In my case the reason is that i create a different website (port 20080) and aspnet_client folder is not placed inside that website
I can see that you use different versions of software and different configurations, but i think you have the same problem.
Solution
The solution is to work on IIS this way:
Copy aspnet_client folder from c:\inetpub\wwwroot folder to the new website root folder.
or (this one is better)
Create a virtual directory called aspnet_client that points to c:\inetpub\wwwroot inside the new website
I think you miss path of report. Please check report path at loading time. Because i have already fetch same issue. So change path in publish version on server.
May be this help to you....
OK ,
( ~ If the server has the older version, then you have to make your framework &
Crystal Reports References compatible with the server sittings . ~ )
So in my case i changed all of my projects framework to framework 3.5 and all my
Crystal Reports References to version 10.5.3700.0 . And still using the 2010 Visual Studio .
IT is working fine now . Thanks for helping guys .
To avoid copying aspnet_client folder simply add in webconfig:
<businessObjects>
<crystalReports>
<crystalReportViewer>
<add key="resourceURI" value="~/localhost/aspnet_client/system_web/4_0_30319/crystalreportviewers13"/>
</crystalReportViewer>
</crystalReports>
</businessObjects>
Note: aspnet_client folder must be configured as an application in IIS
This worked after adding the section shown in the image, in the webconfig
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304, Custom=null"/>
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="true"/>
</rptBuildProvider>
<crystalReportViewer>
<add key="ResourceUri" value="/crystalreportviewers13"/>
</crystalReportViewer>
</crystalReports>
</businessObjects>

ASP.NET website is working in IIS but not in browser

I have deployed my asp.net 2.0 website on IIS, and I tested there by browsing website in IIS and it's working fine.
But I am getting the below error while browsing the website
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 'xmlns'.
Source Error:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Previously when we used to create a website in IIS, it worked fine. I have checked the website folder in IIS [ By clicking Property > ASP.NET] and the framwework tageted there is 1.1, and it is in read only mode. If the problem is related to this issue than please let me know how to change it.
In the Property > ASP.NET tab you need to select the 2.0 version in the version combo. If not available, it means that .NET 2.0 is not properly installed with IIS.
I had this exact error message on a machine where I installed .NET 2.0 prior to IIS.
You can fix this by opening a .NET 2.0 SDK Command Prompt, and run
aspnet_regiis.exe -ir
This will register .NET 2.0 in IIS, and you will get it available in the version combo.
NOTE:
An alternative to run it in the SDK command prompt, is to open a standard command window and navigate to the .NET Framework 2.0 installed location and run aspnet_regiis.exe -ir from there.
On my installation this is:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50110>
The error message you're getting is that the attribute xmlns of the element configuration is not recognized. Before anything else, have you tried removing the xmlns attribute?
I've just double checked by looking at a web.config file I have to hand and the start of it looks like this:
<?xml version="1.0"?>
<configuration>
<configSections>
i.e. No xmlns attribute on the configuration element

Resources