DB2 .Net Connector error : AESEncryptADONet - .net-core

I have a very simple .Net Core app trying to create and open a connection to a DB2 database (on AS/400).
I have this error when I try to create the DBConnection object, with the message:
ERROR 58005 SQL0902 There are no context policies. Function: AESEncryptADONet.
There are no more details, unfortunately.

We meet the same error and solved it by setting Path of environment variables on Windows / Linux (LD_LIBRARY_PATH) / MacOS (DYLD_LIBRARY_PATH).
For example:
Our environment:
ASP.NET Core v3.1
IBM .NET Core 3.1 / EntityFrameworkCore 3.1 in v11.5.4
IIS 8.5
Windows Server 2012 R2 (64 bits)
In web.config, we add the <environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" />.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location ... >
<system.webServer>
...
<aspNetCore ... >
<environmentVariables>
<environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
Set folder permissions (Read & Execute, Read, and List Folder Contents) for Application Pool Identity Accounts (IIS AppPool\[App_Pool_Name])
Please click the links below for more information.
Frequently asked questions about IBM Db2 .NET Core Provider
Q: I am getting the following error:
An unexpected exception has occurred in Process: 244 Function: AESEncryptADONET (Encryption Info)
The .NET driver is unable to find the compatible GSKit. Set the Path(on Windows) or LD_LIBRARY_PATH(on Linux) to the <Package_Install_location>/<package-name>/<version>/build/clidriver/lib directory of your environment. Remember, this may affect other applications.
Db2 .NET Packages downloading and initial configuration

Install the VC++ runtimes (x86 and x64)
You should go with at least the 2013 version as well as the latest. Should solve your problem. It did for me.
I had a fresh 2019 Windows Server, installed dotnet 6 runtime , and I couldn't run my .NET6 applications (Web and console) trying to connect to my DB2 DB using "Net.IBM.Data.Db2": "6.0.0.200", as it threw the same error as you.
I installed the runtimes and it solved the issue.
Cheers

Putting these lines into my Azure Function App csproj did the trick:
<!--For publishing-->
<Target Name="CopyFilesAfterBuild" AfterTargets="Publish">
<Exec Command="(robocopy $(PublishDir)clidriver\ $(PublishDir)bin\clidriver /E)
^& IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0" />
</Target>
<!--For debugging-->
<Target Name="CopyFilesAfterBuildToPublish" AfterTargets="AfterBuild">
<Exec Command="(robocopy $(TargetDir)clidriver\ $(TargetDir)bin\clidriver /E)
^& IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0" />
</Target>

Related

The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll failed to load. The data is the error

I have recently update an aspnetcore project from .NET Core 2.1 to .NET 6.0.
Since the update, the application will not run in IIS 10.0.
When I attempt to run the application, the application pool exits, and I see the following error in the Event Viewer:
Log Name: Application
Source: Microsoft-Windows-IIS-W3SVC-WP
Date: 1/18/2023 10:37:14 AM
Event ID: 2280
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: MACHINENAME.dev.oati.local
Description:
The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll failed to load. The data is the error.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-IIS-W3SVC-WP" Guid="{670080D9-742A-4187-8D16-41143D1290BD}" EventSourceName="W3SVC-WP" />
<EventID Qualifiers="49152">2280</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2023-01-18T16:37:14.436510400Z" />
<EventRecordID>368815</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>MACHINENAME.dev.oati.local</Computer>
<Security />
</System>
<EventData>
<Data Name="ModuleDll">C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll</Data>
<Binary>7E000000</Binary>
</EventData>
</Event>
I have installed the relevant Windows Hosting Bundle:
I have installed the relevant Microsoft Visual C++ Redistributable:
I'm not sure what to check next. I have gone through multiple similar stackoverflow questions, as well as the aspnetcore github issues list and have not gotten a good idea of what to look at next to debug the issue.
EDIT:
Here is the Jexus Manager output for the application --
So it says ASP.NET Core module version 2 is not installed properly.
It is not clear to me why that would be the case, or how to remedy it.

.net core Windows Service Wix install Window service issue : The application to execute does not exist

I am using VS 2019 and .NET Core 3.1.
I have converted windows service to .NET Core 3.1 and tried to create the msi installer using WIX.
I have created the installer, and while trying to start the application I am getting the error like
The application to execute does not exist: 'C:\Program Files (x86)\DRAProcessorServiceFolder\Django_DRAProcessorService.dll'.
My product.wxs code is below
<File Id="Django_DRAProcessorService" Name="Django_DRAProcessorService.exe" Source="..\Django_DRAProcessorService\bin\Release\netcoreapp3.1\win10-x64\Django_DRAProcessorService.exe" Vital="yes" KeyPath="yes" />
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="WorkingService2"
DisplayName="Django_DRAProcessorService"
Description="Django_DRAProcessorService"
Account="NT AUTHORITY\LocalService"
Start="auto"
Interactive="no"
ErrorControl="normal"
/>
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="Django_DRAProcessorService"
Wait="yes" />
If anybody knows any solution please help me.

HTTP 502.5 - ASP.NET Core cannot start in IIS

I am having trouble starting an ASP.NET Core website on IIS on a Windows Server 2012
I get the following error in the Windows EventLog:
Application 'MACHINE/WEBROOT/APPHOST/IDENTITY' with physical root 'D:\CompanyName\IdentityServer\' failed to start process with commandline 'dotnet .\identityserver.dll', ErrorCode = '0x80004005 : ff.
I enabled stdout logging, but the log files it produces are empty = 0kb.
I updated the entire folder to have full control for the IIS Application Pool user.
I also installed the Hosting Bundle, and the Microsoft Visual C++ 2015 Redistributable...
The application runs without problem, when I run it in the command line:
dotnet .\identityserver.dll
The only way I can get it running, it to set the Application Pool Identity to NETWORK SERVICE
So to me it seems it is a permission issue, but the application pool identity has accesss to everything in the websites folder??
Do you have install .NET Core Runtime to you server and restart IIS?
If already installed one. try check your Application pool > ".NET Framework version" selected at "No Managed Code"
If still don't work try change below code in "web.config"
<aspNetCore processPath="dotnet" arguments=".\mywebsite.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
to
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\mywebsite.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
https://www.microsoft.com/net/download

IIS (There was an error while performing this operation)

I receive There was as error while performing this operation error referring to web.config. I follow below configuration:
OS is Windows server 2012 R2 with IIS version 8.5.
URL Rewrite 2.1 module is installed on the machine.
IIS_IUSRS has full access to the directory.
Application Initialization module is installed
.Net CLR Version v4.0.30319 and managed pipeline mode is integrated.
IIS configuration is as below:
Web config is as below:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MES.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: e8701310-485f-4f88-b7d0-1473d07238ac-->
browsing the page I receive below message:
However, when I remove
<aspNetCore processPath="dotnet" arguments=".\MES.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
from web.config I don't receive (There was as error while performing this operation) error but I get below error:
This error occurred for me when trying to double-click on the Logging module for any site with a bad Web.config.
"Bad" includes Web.configs that just have a module IIS doesn't understand - in my case, IIS 10 couldn't understand the <rewrite> tag, and exploded with this extremely confusing error.
You can verify this by just commenting out the contents of your Web.config. The error goes away - then just gradually reduce how much is being commented out until you find the culprit, and track down that solution.
Add <aspNetCore> back and also install ASP.NET Core module on this machine,
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?tabs=aspnetcore2x
I also wrote a tool to better automate such detection,
https://www.jexusmanager.com/tutorials/oob-500.html
This error is typically caused by a reference inside the web.config which cannot be resolved by the dotNet runtime.
If you are using dotNet core, AND you installed the dotNet core hosting bundle BEFORE you configured your server to run IIS you may get this error.
To fix it in this case, you need to re-run the dotNet core hosting bundle installer AGAIN, in "repair mode"
As described in the box entitled "Important", here.
I had this problem with .NET Core 2.1.
I installed 2.1 SDK (v2.1.301) and as Microsoft says Hosting Bundle now installs with SDK, but in my case this did't work.
This problem disappeared only when I installed 2.1 Runtime (v2.1.1) for Hosting Bundle Installer.
Maybe you need to install URL Rewrite
I had same problem.

ASP.NET 5 project hosting on IIS

I want to host my ASP.NET 5 project which uses MVC 6 and Entity Framework 7 on Amazon free micro instance.
I can't find any step-by-step manual on how to host ASP.NET 5 projects on IIS, all materials just mention that this is possible but without any guides.
Basically, I'm deploying to local folder and then copying to newly created site, but nothing is working.
Unfortunately, I can't use Azure as it only has one month free trial, not a year.
I'm using Visual Studio 2015 Preview to create ASP.NET 5 projects. I don't think that's difficult to deploy on IIS now.
First publish your website by publishing it as file system in VS 2015 preview, then copy the published folder to your server, create an application in IIS and set the application folder to the wwwroot folder (rather than the root folder), that's all.
Be aware, check if "Microsoft.AspNet.Server.IIS" exists in your website project.json before publishing it.
Edit:
there should be a web.config in wwwroot folder, the content of web.config may be like this (with precompile option when publishing):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta1" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta1" />
<add key="kre-clr" value="CoreCLR" />
<add key="kre-app-base" value="..\approot\packages\Rvc.PopUpSite\1.0.0\root" />
</appSettings>
</configuration>
or like this (without precompile option):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta1" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta1" />
<add key="kre-clr" value="CoreCLR" />
<add key="kre-app-base" value="..\approot\src\Rvc.PopUpSite" />
</appSettings>
</configuration>
Please notice the value of kre-app-base. Occasionally its value is empty string after publishing in Visual Studio.
I had the same problem with DNX Beta 4.
If someone has the same problem :
You have to target x64 framework (Target DNX Version) when you publish your website in Visual Studio 2015 RC and write "XXX\wwwroot" in Physical Path in your IIS website configuration.
1. First you need to publish the site to the file system:
2. Create a new application in IIS:
3. Unzip the file you've created in step 1 in the website directory from step 2. The folder should look like:
4. You may also need to install DNVM (formerly KVM) and the DNX Runtime Environment (formerly KRE):
Install the DNVM - dotnet version Manager (KVM)
Install the DNX runtime environment inside DNVM (KRE)
You can use the File system publish method. Follow these steps:
1/ Generate in a folder with Visual studio the .dll files
2/ Create a website in IIS manager and give in the path to your folder
I found what I've missed, I need to change url to my public DNS in projct.json file:
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://ec2-54-68-21-4.us-west-2.compute.amazonaws.com/
then after uploading site to Amazon I need to run web.cmd in site root

Resources