How change IIS Express runtime from 4.0 to 2.0? - asp.net-mvc-2

I'm trying to run using SharpDevelop a MVC2 web app. When I try to run the application, the following error show up in the browser:
Config Error There is a duplicate
'system.web.extensions/scripting/scriptResourceHandler' section
defined
and ...
If you see the text "There is a duplicate
'system.web.extensions/scripting/scriptResourceHandler' section
defined", this error is because you are running a .NET Framework
3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the
.NET Framework version to ".NET 2". You can also remove the extra
sections from the web.config file.
I'm on Windows 7 and have installed WebMatrix but can't figure out how to do what the error message tell me:
set the .NET Framework version to ".NET 2"
How can I change that config to avoid the error?

Here is the command:
appcmd set app /app.name:APPLICATION_NAME/ /applicationPool:Clr2IntegratedAppPool
More info about the command here
Remember change to the right(you could have more than one IIS installed) IIS directory before execute the command,
C:\Program Files\IIS Express
in my case.

Related

dotnet build looking for GeneratedMSBuildEditorConfig.editorconfig file?

I'm trying to build a .NET 6 Xamarin iOS app using .NET CLI.
This question is a follow up of this one.
Now the problem is that after a while, the build fails with the following error:
#[error]CSC(0,0): Error CS2001: Source file '/Users/runner/work/1/s/TestApplication/obj/arm64/ReleaseiPhone/net6.0-ios16.0/ios-arm64/TestApplication.GeneratedMSBuildEditorConfig.editorconfig' could not be found.
AFAIK this file is used by Visual Studio and has nothing to do with the .NET CLI.
This seems to be the Roslyn compiler that looks for it.
/analyzerconfig:"obj/arm64/Release|iPhone/net6.0-ios16.0/ios-arm64/TestApplication.GeneratedMSBuildEditorConfig.editorconfig" /analyzerconfig:/Users/runner/hostedtoolcache/dotnet/sdk/6.0.402/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_6_default.editorconfig
EDIT:
/p:RunAnalyzersDuringBuild=false
does not help.
EDIT 2:
This seems to be a new behavior of a .NET 6 build. Originaly, my project is not .NET 6, it has been upgraded to it.

failed to start process with commandline 'dotnet .\myapi.dll', ErrorCode = '0x80004005 : 80008096

I asked a question here on how to ensure the correct version of dotnet is included in the build.
How I am wondering whether the version is still not getting deployed.
What would I be looking for in the deployed files to tell?
Deployment does include the following files
52,816 dotnet-aspnet-codegenerator-design.dll
689,584 Microsoft.CodeAnalysis.CSharp.Workspaces.dll
2,624,944 Microsoft.CodeAnalysis.Workspaces.dll
23,632 Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll
73,296 Microsoft.VisualStudio.Web.CodeGeneration.Core.dll
35,408 Microsoft.VisualStudio.Web.CodeGeneration.dll
69,200 Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll
28,752 Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll
34,896 Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll
157,776 Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll
When I login to the machine the code is deployed on and type
dotnet .\myapi.dll
the error is
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.5' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
Browsing to the site url gives
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681
And the event log shows
failed to start process with commandline 'dotnet .\myapi.dll', ErrorCode = '0x80004005 : 80008096.
How do I ensure dotnet is deployed?
[Update]
I see that c:\program files\dotnet.exe is version 2.1.26919.1
However I have installed .Net Core Runtime 2.1.5 (x64)
I can tell that it is installed because when I re-run the installer it asks whether I want to repair or uninstall.
I suppose that since the api is running under IIS it does not need dotnet.exe ?
The machine is running Windows 2012 Server R2
Just posting this in case it helps someone. I was hitting this exact error attempting to deploy a regular .Net site using ASP.Net Core on IIS. In my case .Net was installed, but my site was throwing a 500 Internal server error and in the Event log I was showing "failed to start process with commandline 'dotnet .\myapi.dll'". It ended up being my web.config file, which Visual Studio had the line starting like:
<aspNetCore processPath="dotnet" arguments=".\myapi.dll"
This ended up being the problem, this is how you would launch a .Net Core site. But I was targeting regular .Net. So my web.config needed to be:
<aspNetCore processPath=".\myapi.exe" arguments=".\myapi.dll"
Before finding this I had attempted to install .Net Core runtimes, and SDK, both of those ended up morphing the error into a 500.19 Internal Server Error with error code 0x8007000d. This indicated a malformed XML in my web.config or AppHost (IIS). Neither of those files had XML syntax issues. This particular error was caused from having removed the .Net Core Hosting Bundle. You need to have the hosting bundle installed for your server to recognize the "aspNetCore" tag. Once the hosting bundle was installed and the web.config change made I was running.
Hope that helps someone. This was the first search result I hit beginning to debug.
When I ran
dotnet run .\myapi.dll
I got
Did you mean to run dotnet SDK commands?
Please install dotnet SDK from: go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
when I went to the URL it installed SDK 2.1.403
which worked.
I had to "Repair" .Net Core 2.1 Windows Server Hosting to get rid of this error.

C# application .Net 2.0 Couldn't run in Windows XP

I built a .Net 2.0 Application for Windows XP but I made it in Windows 7.
The application contains a Mysql.data connection and CrystalReport. When I try to run it on Windows XP, the application does not run, giving an error message of:
The application failed to initialize properly (0xc000007b).
I tried to rebuild application in Windows XP, but when I rebuilt and ran it in Visual Studio, the following error occurs:
Could not load file or assembly or one of its dependencies. The module was expected to contain an assembly manifest.
How can I fix this?
Please try the following:
1.Uninstall the .NET Framework 3.5 from Add/Remove Programs (in the Control Panel) on Windows XP or Programs and Features on Windows Vista/Windows 7.
Even if the uninstall fails, go on to step 2.
2.After the Framework 3.5 has been uninstalled or if it failed, download and run the .NET Framework removal tool.
Here's the link to Aaron Stebner's Framework Removal tool on Windows Live Skydrive:
http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog_Tools/dotnetfx_cleanup_tool.zip?wa=wsignin1.0&sa=17797669
Aaron Stebner is a Microsoft employee. The tool he's developed is linked on that page and makes easy work of cleaning up damaged .NET Frameworks from your system so they can be reinstalled. When you run the tool, choose the .NET Framework 3.5 from the list and choose to cleanup. After this is done, reinstall the .NET Framework 3.5 that Design 3 needs by running the Expression Design 3 setup package again. It will detect that the .NET Framework 3.5 is missing and reinstall it for you. After that's done, try running Design 3 again.
3.If that still fails to resolve the problem, go to START, RUN and type CMD to run a command prompt. Type CHKDSK /R and hit ENTER. Hit the letter Y and restart the machine. Allow the machine to do the check disk scan. After this is done and it goes back into Windows, try Expression Design again.
more information here

Enterprise Library 5.0 don't show namespace Microsoft.Practices.EnterpriseLibrary.Data

I was using Visual Studio 2008 with Enterprise Library 4.0. It is working fine and showing namespace Microsoft.Practices.EnterpriseLibrary.Data. Now I installed VS 2010 and Enterprise Library 5.0.(because 4.0 sowsn't support vs 2010 ).
But the problem is Enterprise Library 5.0 doesn't show Microsoft.Practices.EnterpriseLibrary.Data. Is there another namespace in 5.0 thriugh which I can access the Database class which comes under Microsoft.Practices.EnterpriseLibrary.Data namespace?
please let me know.
You are probably targeting .NET Framework Client Profile. The Data Access Block has dependencies on System.Data.Oracle and requires the full .NET Framework.
For anyone else hitting this problem with moving their DAAB-based app to .NET4, entlib5 is supplied with the source code installable via e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\src\Enterprise Library 5.0 - Source Code.msi
Running that msi and accepting the defaults creates a EntLib50Src folder under your Documents area. If you go into EntLib50Src\Blocks\Data and open Data.2010.sln you can change the target framework to .NET Framework 4 Client Profile.
This will create a bunch of errors related to the System.Data.Oracle dependency. Remove the reference to it, and then exclude the Oracle parts of the project and comment out any Oracle references in the common code.
If you then recompile with strong name signing on you can use the output assemblies (Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.Data.dll) with .NET Framework 4 Client Profile. You do have to distribute Microsoft.Practices.Unity.dll from the e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin area but this is client profile-compatible.
Note that the above works if you're not needing Oracle support in your app. Mine doesn't, its SQL Server and VistaDB only. The above should work with any non-Oracle db compatible with ADO.NET.

How do I deploy .NET Framework 4 using Active Directory deployment?

I know it's possible to deploy earlier versions of the .NET framework using AD deployment, for example: http://msdn.microsoft.com/en-us/library/cc160717.aspx.
How do it do this for .NET 4? I tried unpacking the standalone .NET 4 installer and deploying the netfx_Extended_x86.msi package. This didn't work. After a reboot the event log shows that it tried but it failed to install with a message saying to run setup.exe.
Didn't test it but look at this: How to deploy .NET 4.0 Framework