DevExpress DLL's License Exception in visual studio windows application due to CAS Policy - winforms

Exception occurred creating type 'DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v8.2, Version=8.2.8.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1' System.TypeInitializationException: The type initializer for 'DevExpress.Utils.AppearanceObject' threw an exception. ---> System.NotSupportedException: This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information. ..\Properties\licenses.licx
Tried below configuration in app.config to resolve the issue but did not work:
`
<configuration>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
<startup>
<supportedRuntime version="v3.5.0000"/>
<!--<supportedRuntime version="v1.0.3705"/>-->
</startup>
`
Is there any extra configuration or setup required to resolve this issue?
Tried the steps given in the link below to resolve the issue:
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/dd409253(v=vs.100)
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/w4atty68(v=vs.100)

Related

Error when running a .net core web app with React.js on IIS 10

I have a web app based on .net core v2.1 with a React.js front-end, which I'm trying to host on IIS 10. The app runs fine via Visual Studio (2017), however when I publish the app and host via IIS, I get the following error:
Error image
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Error Code 0x8007000d
The web.config file was generated during the publish; I have not modified it:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SkillsMatrix.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: ea8a300c-5bb6-4a29-a8d2-d13dddbbac1d-->
This same error happens if I start a brand new project via VS, do not add any code, and publish it to IIS...
I have tried:
Giving access to the folder/file to the IIS_IUSRS user group
Removing app.UseHttpsRedirection(); in StartUp.cs
Does anyone have any suggestions for how I can clear this error and host my app?
You could try the below steps to resolve the issue:
1)Make sure you download and install the .net core hosting bundle and runtime.
https://dotnet.microsoft.com/download/dotnet-core/3.1
2)Make sure that the Application Pool > Process Model > Identity is set to ApplicationPoolIdentity or your custom identity has the correct permissions to access the application's deployment folder.
3)Set the application pool set the .NET CLR version to No Managed Code:
4)Confirm that you have enabled the proper server role. See IIS Configuration.
you could the below link for more detail:
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1

Turning off custom errors in Windows Service

I have a Windows Service that uses .NET Remoting (yes I know remoting has been replaced by WCF but this is a legacy application).
When I run the service I get this:
Exception Type: System.Runtime.Remoting.RemotingException Message:
Server encountered an internal error. For more information, turn off
customErrors in the server's .config file.
I have this in my application's config file:
<configuration>
<system.runtime.remoting>
<!-- other settings go here -->
<customErrors mode="Off" />
</system.runtime.remoting>
</configuration>
Oddly, I still get this exception. What am I doing wrong?

Config transform error setting up Episerver 9 Commerce project

I am following instructions to set up a new Episerver 9 commerce site.
I've followed the instructions at: http://world.episerver.com/documentation/Items/Installation-Instructions/installing-episerver/#Commerce
When I install NuGet package EpiServer.CommerceManager I get the following error:
An error occurred while applying transformation to 'web.config' in
project 'WebCommerceApplication' No element in the source document
matches '/configuration/system.serviceModel/services'
What do I do wrong?
It seems you have a transform for an element that's missing in web.config.
Make sure you have an element like...
<configuration>
<system.serviceModel>
<services />
<system.serviceModel>
<configuration>
...in your web.config.

Entity Framework in Child Project Not Working in Parent Project

I have a project that contains my Entity Framework generated models and DBContext. I am attempting to reference that project from another project which has the following config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
But anytime I instantiating the context: using (var db = new DataDB()) { ... } I get the error below:
An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
I also installed EF for my project. Not sure what else needs to be configured to get this working?
If anyone is looking, you probably have created your model in a separate project. You need to add references for EntityFramework and EntityFramework.SqlServer

Why does my app require the full .NET 4 Framework?

I have a WinForms app targeting the .NET 4 Client Profile. However, when I try to run it on a machine that has only the Client Profile (and not the full/extended profile), I get ".NET Framework Initialization Error" saying I need to install ".NETFramework,Version=v4.0":
I've double-checked the project file to make sure that it is indeed targeting the client profile, and it is:
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
As are all of the projects it references. I'm not even sure where else to look - what is going on here?
Check your app.configs and verify the supported runtime specified in the startup:
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
should be replaced with
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>

Resources