IIS Website on Server 2016.
using System.Text
string x = "abcdefg";
byte[] y = Encoding.UTF8.GetBytes(x);
Results in:
Compiler Error Message: CS0117: 'Encoding' does not contain a definition for 'UTF8'
It isn't complaining that "Encoding" is undefined, but that .UTF8 in the Encoding class is undefined.
Works fine on my own desktop running IIS Express in Visual Studio, but when deployed to Server, gives the above error message.
My local dev machine has: .NET Framework 4.7.2
Server has only Microsoft .NET Runtime 5.0.9 and Microsoft ASP.NET Core 5.0.9. In fact, the server does not have any version of .NET Framework installed, yet all other web apps (mine and others) are working fine.
Can I install and run .NET Framework 4.7 alongside .NET Runtime 5? And should it be necessary in the first place? Does .NET Runtime 5 not include Encoding.UTF8?
Thanks.
EDIT: There is nothing wrong with this code. This is a question of framework dependencies or interrelations.
Reinstalling the .NET Framework on the server ultimately fixed this.
Related
Need to find which .net version is used by web application after its deployed in IIS server with multiple .net framework versions installed in it
My Asp.net web application is compiled with target framework 4.0 and deployed in IIS 10 server. In IIS server, application pool is configured to run with CLR version 4.0.30319.
In the Deployment server, .net framework 4.0 to 4.6.2 is installed. Found this from regedit.
In this case, how to find if the web application is running under the 4.0 framework or 4.6.2 framework ?
While printing the environment.version property in aspx page of the web app, the version displayed is 4.0.30319.42000.
(https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed "Microsoft Version Detection Link")
According to the above Microsoft link, 4.0.30319.42000 means .net framework version is 4.6 or above.
However, as per above link, environment.version property is not supposed to be used to identify the .net framework version post 4.5 series.
Hence confused how to find out the framework version under which web application is running ? Does it run with latest .net framework version ? Any property or official method to find this.
Intention is to migrate the web application to run with latest target framework if it's running currently below 4.5.1 version as these are not officially supported.
Sorry for the long post but couldn't explain in less words.
I always have bad times publishing to IIS 8.5
I have a old project in .NET Core 1.0, but I have made a new project, but this time, in .NET 4.5 (for several reasons)! This new project (.NET 4.5) replaced the old (.NET Core)
In Visual Studio 2015, everything works correctly, then, I build the project, and copied the files to IIS folder (\inetpub\wwwroot).
When I visit the page, I got a error HTTP Error 502.5 - Process Failure.
Then, I remember that the APP Pool was using .NET Core, so, I changed to .NET CLR 4.0, but still no luck.
I don't even known where is the error LOG on IIS to see if I found anything...
I already see the logs on %WINDIR%\System32\LogFiles\HTTPERR and \inetpub\logs\. No error on logs.
All I found about the error 502.5 is that almost always is related to .NET Core (but i'm using .NET 4.5)
Like I posted on comments, the main error was because the Handler Mapper order.
The old project it was a .NET Core project, and the new project, is a .NET 4.5.
For some reason (or my fault), the Handler Mapper was all wrong.
I have an asp.net web application I have built using Visual Studio 2010 C# (.net 4.0). I deployed it successfully onto Windows Server 2003 with .net framework 4.0 installed on it.
I am now trying to deploy it on Windows Server 2012 R2 with .net framework 4.5 installed on it (I have to use 4.5 as another application on the machine requires it).
I am getting this error message during instillation:
Could not open key: Software\Microsoft\ASP.NET\4.0.30319.0. Verify that you have sufficient access to that key, or contact your support personnel.
I have read many posts that suggest I rebuild my application changing the 'ASPNETVersion' to 2.0 instead of 4.0. This does not work however as .net framework 2.0 is not installed on the server and I encounter build issues when building on my dev machine with .net 4.0.
IIS Application pool is pointing NET CLR to 4.0. The version of .net in the server regedit file is v4 (Client 4.5, Full 4.5), v4.0 (Client 4.0).
Is this possibly because v4.0 Client profile is installed rather than the full 4.0 .net install? I have looked online and it doesn't look like full 4.0 .net can be installed on Windows Server 2012 R2?
I wrongly presumed that ASP.NET was part of the .NET framework installation. I went back to the IIS install and installed ASP.NET which was listed under the development section. The Installer now starts correctly.
Can any one help my to fix following error i setup .Netframwork the IIS and register asp.net (aspnet_regiis.exe -i)
Error
Sounds like you hit this issue and need to take some special steps,
http://blogs.msdn.com/b/asiatech/archive/2014/10/28/case-study-http-error-500-0-internal-server-error-from-aspnetinitclrhostfailuremodule.aspx
Root Cause
Although the .NET 4.0 was installed on this computer, the version of
%windir%\system32\mscoree.dll was still v2.0. It should be replaced
with v4.0.
It loads .NET 2.0 runtime mscorwks.dll, not the .NET 4.0 runtime
clr.dll. Therefore some unexpected behaviors occur during the CLR
initialization that causes the worker process to be recycled.
Resolution
You can reinstall .NET 4.0 or re-apply Windows 2008 R2 SP1 to update
mscoree.dll.
I'm trying to use .NET 4.0 to build a Exchange 2010 transport agent.
But I had to compile as x64 and .NET 3.5 for the install to work (used VS2013) otherwise I get an error: "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." when trying to install the agent.
.NET 3.5 was required by the two references
Microsoft.Exchange.Data.Common
Microsoft.Exchange.Data.Transport
But according to this .NET 4.0 is supported on Exchange 2010
I've used this guide to build the agent
I tried to follow this article but I can't get a .NET 4.0 version of the .dll to install
Yes, it can be built in Framework .NET 4.0.
what actually matters is the correct version number of the following files:
Microsoft.Exchange.Data.Common
Microsoft.Exchange.Data.Transport
PLEASE NOTE:
Whenever you update the Exchanger Server (E.g. Service Pack, Update Rollups) ther version of these two files might chance.
So, Microsoft Exchange Transport Service does not get up again