Microsoft Sync framework Architecture Conflict - azure

I have developed an application using Microsft Sync framework 2.1, It works fine on my local system which is a 32bit windows 8 PC. However when I deployed the Server side of the project to azure (which is a 64bit platform) I get the popular "Retrieving the COM class factory for component with CLSID {EC413D66-6221-4EBB-AC55-4900FB321011} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
which usually means there is a conflict in the system architecture and the Sync library refrenced.
My direct question is, Must the client and server both be on the same architecture for Sync framework to work i.e can we have server on 64bit and client on 32 bit

if you're deploying two tier, the client and server platform do not need to match. but the build target for your app must match the platform for the Sync Fx you installed.
e.g., If the target platform of your app (check your Project properties in VS), is x86, then you should have x86 Sync Fx installed

Related

.NET Core Web API only works when IIS CLR Version NOT set to No Managed Code

I have a .NET Core web API that works fine when hosted in IIS on my local Windows 10 desktop OS. However, when I deploy the same code to a Windows Server 2016 machine, the app pool in IIS fails 5 times and then stops the app pool. The error in the event viewer indicates the following:
A process serving application pool 'My API' reported a failure during application preloading or service loading. The process id was '416'. Please ensure that all application preload or service settings in the application pool are configured properly. The data field contains the error number.
I've tried configuring the API to write out to the stdout, but it doesn't ever generate a log file.
This API was originally written in .NET Core 2.2, so I tried upgrading it to .NET Core 6 and have the same issue - it works in Windows 10 with IIS, but not on Windows Server 2016. The hosting bundle for the appropriate version is installed on the server. I found that if I change the app pool that is hosting my API to have a .NET CLR Version of .NET 4 instead of 'No Managed Code', it then works. All documentation indicates 'No Managed Code' is recommended.
I did actually get it to work at one point with the app pool set to 'No Managed Code'. I ran procmon to see if there were any failures accessing registry keys, system files or folders, etc. and did find that if I copied a few files like webengine.dll, webengine4.dll, and aspnet_rc.dll from the folders they were actually in to folders where procmon indicated it was looking for them in, it then worked. Obviously though I don't want to be copying system files to various locations.
My guess is that something isn't installed on the server or I've misconfigured something as I got the same result when creating a test Web API project in Visual Studio and used the sample endpoints included in the default project. Unfortunately I can't figure out what is missing or misconfigured.
I ran the JexusManager ASP.NET Core Diagnostics tool and this is the report:
System Time: 7/20/2022 8:01:35 AM
Processor Architecture: AMD64
OS: Microsoft Windows NT 10.0.14393.0
Server Type: IIS
Scan 35 installed module(s).
ASP.NET Core module version 2 is installed for .NET Core 3.1 and above: C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll (16.0.22173.7).
Scan 91 registered handler(s).
* Found a valid ASP.NET Core handler as { Name: aspNetCore, Path: *, State: Enabled, Module: AspNetCoreModuleV2, Entry Type: Local }.
Visual C++ runtime is detected (expected: 14.0, detected: 14.12.25810.0 built by: VCTOOLSREL): C:\Windows\system32\msvcp140.dll.
The application pool 'Test API' is used.
Pool identity is NetworkService
Please ensure pool identity has read access to the content folder D:\Program Files (x86)\My Company\Test API.
Pool bitness is 64 bit
Scan aspNetCore section.
"processPath": dotnet.
"arguments": .\TestApi.dll.
"hostingModel": inprocess.
In-process hosting model is detected. To avoid 500.xx errors, make sure that the bitness of published artifacts matches the application pool bitness
Framework dependent deployment is detected. Skip bitness check.
Found runtime config file D:\Program Files (x86)\My Company\Test API\TestApi.runtimeconfig.json.
Runtime is 6.0.0.
I did verify the bitness and the folder permissions. Both were set properly.

"The RPC server is unavailable" Error on Azure Could Server 2019

This is regarding Abbyy Setup issue that we are facing on a Azure Cloud Machine which is a Windows Server 2019 VM.
We followed the Admin Guide for Reader 12, the "Manual Runtime Installation Steps" were followed for the setup. The Bin64, Data and Inc folders are copied into a directory which will be later used while registering FREngine.dll on the OS. We have not done the Abbyy SDK installation.
We have VM setup locally which is a Windows Server 2019 VM image. On this setup we are able to Register the FREngine.dll successfully using regsvr32 command. Also we don’t see any issue and is working, w.r.t reading OCR/Barcode values successfully through Abbyy FineReader.
ISSUE
The issue is on the Azure Cloud System [VM Windows Server 2019], where we are able to Register the FREngine.dll successfully using regsvr32 command. However even with the successful Registration of FREngine.dll, when we try to initialize the FREngine, we are getting an exception "Invalid Engine instance" during the call to InitializeEngine( ) with all the Required parameters set.
// Create the abbyy engine instance in outproc process,
// as its recommended by Abbyy for 64-bit process
outProcLoader = new OutprocLoader();
if (outProcLoader != null)
engine = outProcLoader.InitializeEngine(AbbyyEngineUtils._strProjectId,
engLicensePath,
AbbyyEngineUtils._strEngPwd,
"", "", true);
Here we have a license file which is also copied into the location where FREngine.dll is present.
Due to this initial Step failure Abbyy Logs could not be generated from the codebase. However we see a log file that gets generated from Abbyy in the path “C:\ProgramData\ABBYY\SDK\12\FineReader Engine\” at this point of failure which states as follows:
10552 :ABBYY Licensing Service is unavailable: The RPC server is
unavailable.
We also we additionally tried running the Abbyy SDK’s Sample applications on this machine. This also fails with the above error during Abbyy Engine Initialization.
How can this be resolved?
More Info on Licensing Service:
We additionally tried installing the LicensingService and the LicensingSettings.XML had :
ProtocolType="LocalInterprocessCommunication" />
Here Ours is a Standalone Abbyy Installation and hence the Protocol Type used is LocalInterprocessCommunication which is for the local Licensing Service. It is not necessary to specify this protocol type for Standalone installation, as Standalone licenses are always used with the LocalInterprocessCommunication protocol type.
This was an additional Step tried by us. However the actual issue was with the Abbyy Licensing on Azure.
Did you happen to start the abbyy licensing service in the Azure VM ?
(Windows Key + R) Run command --> services.msc
In the Services Dialog, find the Abby...Licensing service.
Right Click -> Properties
You can click on the start and click ok.
Retry your above steps. Also, you could have startup type as Automatic if this works in the services in dialog.
As any other OCR solution some have licensing constraint to run on Azure and AWS , make sure your license is compatible.
as posted here
https://support.abbyy.com/hc/en-us/articles/360016441600-Can-I-run-FineReader-Engine-in-Virtual-Machine-or-Container-
also I would check the OS compatible version.
ABBYY SDK 12 Licensing Service has been tested in the following virtual environments:
Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2
Windows 10, Windows 8.1, Windows 8, Windows 7 SP1

ASP.NET Core 2.0 app targeting .NET 4.6.1 fails to host on IIS

The problem
IIS ASP.NET Core module is unable to start an ASP.NET Core 2.0 app.
Browser: HTTP Error 502.5 - Process Failure
Windows Event Log: Application ‘MACHINE/WEBROOT/APPHOST/AppSite’ with physical root ‘C:\inetpub\apps\AppFolder\’ failed to start process with commandline ‘C:\inetpub\apps\AppFolder\App.exe’, ErrorCode = ‘0x80004005: 1’.
ASP.NET Core Module Log: Log file is created but is empty.
The setup
App: ASP.NET Core 2.0 targeting .NET Framework 4.6.1.
Server: Windows Server 2012 R2 Standard 6.2.9200 with IIS 8.5.9600.
The story
We've created a blank MVC Web application using the default project templates provided in Visual Studio 2017.
The app is deployed following the official specification: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/.
The confusion arises mainly from these two points:
Running the app through command-line on Kestrel works.
Running a different app but targeting .NET Core 2.0 and publishing as framework-dependant works flawlessly on IIS.
But between these two apps: the codebase is the same, the IIS website and application pool is the same and we even emptied out the app directory and used the same one.
Due to these points the only difference seems to be the net461 app's executable file.
We do not have full control over the Windows Server where we're trying to deploy but we do have administrator accounts. The current assumption is that the issue lies within permissions - maybe AD group policies, antivirus blocking the file but we're still awaiting response from the client's sysadmins. Meanwhile we haven't been able to replicate the error code ‘0x80004005: 1’ while trying to setup these restrictions on our development machines.
Here's an incomplete list of ideas and points about the issue we've tried while problem solving:
The initial app (targeting net461) works flawlessly on IIS when
deployed to other servers (Windows 10 Enterprise, Windows Server 2012
R2 Datacenter).
Reinstalling different versions of ASP.NET Core/.NET Core: Runtime & Hosting Bundle.
Setting NTFS permissions to the dotnet folder.
Changing IIS application pool identity to an administrator account.
Restarting the server.
Going over local group and security policies.
Going over the antivirus settings and logs.
Trying to deploy on a brand new server (same OS, same bloat).
All ideas/comments are greatly appreciated. The more obscure the better.
EDIT:
Since this got flagged as a possible duplicate of ASP.NET Core 0x80004005 I need to specify why that is not a duplicate.
That referenced project is an older version of ASP.NET Core (last use
of project.json was in 2016)
That referenced project targets .NET Core and not .NET 4.6.1. It is mentioned here as well that targeting .NET Core works on IIS in regard to this issue.
Selected answer points out that they fixed it by:
Turns out that this was result of needing to install some windows
updates and this problem:
api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft
Office file
Rather than install the version discussed in the above issue I whet
into Programs and Features and ran a repair on Microsoft Visual C++
2015 Redistributable.
but the installation of Microsoft Visual C++ 2015 Redistributable is one of the steps in the official setup guide and it is mentioned here as well that the official guide has been followed during the setup process.
We have gone over that post and tried to repair and reinstall the Microsoft Visual C++ 2015 Redistributable runtime components and this did not fix the issue.
If anyone stumbles upon this post in the future:
The problem was indeed in the server's antivirus. It wasn't directly blocking the app's executable but its call to a class library in the system folder. This termination did not raise any of the usual alarms.
The application "C:\inetpub\apps\AppFolder\App.exe" attempted to load the library "bcrypt.dll" by calling the function "LoadLibraryExW". The operation was blocked and the application terminated.
After switching the MVC blank app to a completely blank Hello-World app it ran successfully.

How to change Azure App Service to 64-bit

I have been having trouble making a request to my 64-bit ASP.NET Core API running on an Azure App Service. The error I get back is:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '***.dll'. An attempt was made to load a program with an incorrect format.
I understand that this means there is a mismatch between the platform of the app (64-bit) and that of the environment it runs on. I just can't figure out how to change the App Service so it runs using 64-bit.
In the Application Settings in the Azure portal I have set Platform to 64-bit:
However when I check in Kudu, the runtime environment indicates that it's operating under win8-x86:
project.json
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"platform": "x64"
},
"runtimes": {
"win10-x64": {}
}
Some questions
How do I change the App Service to ensure it's running on a 64-bit platform?
Does it matter that the RID is win8... when my runtimes configuration in project.json specifies win10.... Presumably x86 vs x64 matters, but does it need to be the same version of windows too ie. win8 vs win10.
This is now available in Azure App Service.
Steps to deploy:
Set platform to 64-bit in portal
Ensure the project targets 64-bit by including the following in the csproj:
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
When publishing application ensure target framework is set to win-x64. (If running dotnet publish just add -r win-x64)
The documentation is here but (at present) it is acknowledged to be a little sparse.
This github issue response suggests we should be able to do a framework dependent deployment and have it "just work". YMMV but that wasn't my own experience hence the runtime flag suggestion above
TLDR; 64 bit .NET core processes using the .NET core runtime (as opposed to the .NET Framework runtime) are not yet supported on Azure but is planned to be coming in the future.
The following is from discussions I had with Microsoft Azure support.
The 64bit/32bit configuration on Azure portal (shown above in my screenshot), controls the IIS w3wp.exe process. The w3wp.exe process forwards requests to your NET core process. The configuration doesn't control the bitness of the .NET core process. It's a bit confusing, but explains why changing the Platform option in the screneshot above had no affect.
Based on the PATH environment variable setting of app service, dotnet.exe is mapped to the 32bit one, which is "D: \Program Files (x86)\dotnet\dotnet.exe". The 64bit runtime of .NET core is not pre-installed in app services, as a result, it is currently not available.
Microsoft is planning to add 64-bit support to .NET core applications running on the .NET core runtime in Azure but it depends on a future update of the .NET core tools chain. They gave me an estimated internal date but I promised I wouldn't share that publicly.
A workaround they gave me was to use the ASP.NET core (using .net framework) visual studio template, not the ASP.NET core (using .net core) one. That one loads the 64bit .Net framework runtime for your ASP.Net core web application. This will require a bit of migration work and I assume may not be possible for some projects.
Fortunately I was able to swap to 32 bit versions of some of my dependencies which meant the app worked in the Azure environment. Sadly this won't mean much to those that don't have this option, and I'm sure there are many.
If you need a 64 bit runtime, there are 4 ways to do this:
Deploy a self-contained application
Deploy your own runtime
Use Linux Azure App Service
Use Web Apps for Containers
See more details on how to do it in the link below:
https://blogs.msdn.microsoft.com/webdev/2018/01/09/64-bit-asp-net-core-on-azure-app-service/
Credits to: Glenn Condron
dotnet publish command generates a web.config file which is used by IIS to start dotnet process. In Kudu, in PATH environment variable dotnet.exe is from D:\Program Files (x86)\dotnet
Solution is to replace in this file after build
<aspNetCore processPath="dotnet" arguments=...
with:
<aspNetCore processPath="%ProgramFiles%\dotnet\dotnet" arguments=...

Can StandardSDK 4.0 under EVC++ be used to debug on a remote device?

I'm running Embedded Visual C++ 4 with service pack 4, to develop an application for a device running CE 5.0. I'm using the CE 5.0 SDK for this purpose, which works fine except for the fact that while it will target my device (i.e. an SH4 based PDA), it will not let me select anything other than the StandardSDK emulator for debugging. If I go to Tools / Configure Platform manager, I can connect to my device under Windows CE default Platform, but I cannot select it from the Build Toolbar for output and debugging purposes. Is there any work around for this. I've considered moving to VS2008 for this app, but it breaks a large amount of 3rd party code.
Embedded Visual C++ and "Platform Builder" are different tools. The "Windows CE" SDKs are designed to work with "Platform Builder" to make things like OSes and drivers. However, Applications generally use the "Windows Mobile" or "Pocket PC" SDKs.
So here are three different solutions:
Continue to use EVC++ 4.0
If you want to keep using Embedded Visual C++ 4.0 instead of one of the newer IDEs, you can use "SDK for Windows Mobile 2003-based Pocket PCs". Which I believe is the newest SDK for EVC++ 4.0.
Upgrade to VS2005+
This details how to migrate from EVC++ to VS2005 while still making native apps.
You can use the 5.0 SDK line of features in the "Windows Mobile 5.0 SDK for Pocket PC"
Use Windows CE SDK to make Applications with EVC++ 4.0
It actually is possible to make Applications using a CE SDK. This is used by OS developers to make applications for their OS.
You can develop an application using
Microsoft® eMbedded Visual C++®
together with Platform Builder. Before
you can develop an application, you
must use Microsoft Platform Builder to
create an OS design, build a run-time
image, and then download the run-time
image to the target device.
When you download a run-time image,
Platform Builder uses a download
service to copy the run-time image to
the target device. When the run-time
image runs, Platform Builder
communicates with the target device
over a kernel transport.
To develop an application, keep
Platform Builder connected to the
target device, and then run eMbedded
Visual C++. After you write, compile,
and run the application, eMbedded
Visual C++ uses the established
connection to run the application on
the target device.
Note The previously mentioned
process differs from the process used
to develop an application for a
run-time image not downloaded by
Platform Builder. When you do not use
Platform Builder, you manually connect
to the target device using the
application connectivity
communications framework of Platform
Manager. For more information about
application connectivity, see
Application Connectivity.
-- http://msdn.microsoft.com/en-us/library/ms859575.aspx

Resources