crazyTech
crazyTech

Reputation: 1477

.NET Core 32-bit (x86) version's HTTP Error 500.31 - ANCM Failed to Find Native Dependencies Common solutions to this issue Error:

What steps should I take to build and run .net core Web API application in 32-bit environment/runtime?

This is kind of a continuation of the previous question posting that I placed.

We developed an a .NET Core Web API application using the following technologies:

-NET Core (3.1)

-Visual Studio 2019

Unfortunately, we have to deploy said application to the following environment:

-32-bit Environment

-Windows Server 2008 R2 Enterprise (Service Pack 1)

-IIS Version 7.5

-8 GB RAM

( Also, it needs to be an In-Process because we Only want the .NET Core Web API Application to be within IIS Server )*

On my Development Computer that uses Visual Studio 2019, I installed Net Core 3.1 x86 sdk version ( i.e., the .NET Core 32-Bit version )

Also, within Windows 10 environment variable's Path variable, I ensured that the .NET Core 32-Bit version directory path is specified above the .NET Core 64-bit version directory path:

enter image description here

Therefore, within my Visual Studio 2019, I brought up the application. Also, within the Properties of the .NET Core Web Api Web Application’s Section, I’ve ensured that I selected x86 settings values: Force x86 in VS go to the Properties > Build and change Platform target from Any CPU to x86 enter image description here

and also for the Debug Section, I have:

enter image description here

Also, within Visual Studio 2019 Enterprises --->Tools ( in the Main Menu) We Unticked the “Use the 64-bit version of IIS Express for web sites and projects”

enter image description here

The application’s blabhblah.csproj file has the following settings:

 < Project Sdk="Microsoft.NET.Sdk.Web" >

   < PropertyGroup >
     < TargetFramework >netcoreapp3.1 < /TargetFramework >

     < AspNetCoreHostingModel > InProcess < /AspNetCoreHostingModel >

     < PlatformTarget > x86 < /PlatformTarget > 

  < /PropertyGroup >

   < PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Core'" >

      < GenerateResourceMSBuildArchitecture > CurrentArchitecture <  /GenerateResourceMSBuildArchitecture >

     < GenerateResourceMSBuildRuntime > CurrentRuntime < /GenerateResourceMSBuildRuntime >

   < /PropertyGroup >……………..


  < ItemGroup >

    < PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" / >

    < PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.3" / >

    < PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" / >

    < PackageReference Include="Swashbuckle.Core" Version="5.6.0" / >


  < /ItemGroup >

Also, I created a Directory.Build.targets file in the root directory of the Web Application:

< Project >  
    < PropertyGroup 
      Condition="'$(OS)' == 'Windows_NT' and
                 '$(PlatformTarget)' == 'x86' and
                 '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
                 '$(SelfContained)' != 'true'"
                   >

    < RunCommand >$(MSBuildProgramFiles32)\dotnet\dotnet< /RunCommand >   

< /PropertyGroup > 

< /Project >

However, when I run the application, I get the following error:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies Common solutions to this issue: The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. Specific error detected by ANCM: Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-%LAUNCHER_ARGS% does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. 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=2028526

Could someone please help me determine how to resovle the aforementioned "dotnet" missing error? Are there any other modifications to settings/configurations that I need to make?

Upvotes: 0

Views: 1319

Answers (1)

crazyTech
crazyTech

Reputation: 1477

@akseli @omajid @perry-qian-msft @yongqing-yu Sorry, this failed to work, we had to move away from using .NET Core technology( and had to migrate over to .NET Framework 4.7.2) because it would work properly for a little while, and then give us 500 error, and then later some 401 error. I think it has something to do with the configuration because we are using:

-NET Core (3.1)

-In-Process within IIS Server

therefore, Within the standalone IIS Server, we should Not have to run the .NET Core (3.1) application within it's own application pool as "Not Managed Code" because it's all In-Process and .NET Core (3.1) can run on IIS. In any case, we do Not have time to resolve this problem so we migrate over to .NET Framework 4.7.2

@akseli @omajid @perry-qian-msft @yongqing-yu All Thank you for all your responses.
My Team Tech Lead found the solution by specifying the .NET Core Web API Application's Build Settings to "Any CPU" Within Visual Studio 2019 ( Within Visual Studio 2019, Right-click on .NET Core Web API Application, and then choose properties from the drop-down context menu, and then when the window pane shows up on, you select the Build Tab. ) enter image description here

Also, on the IIS Server, my Team Tech Lead ensured that that deployed .NET Core Web API Application's Application pool had the following settings( important to keep in mind that it is "Not Managed Code": enter image description here

Upvotes: 1

Related Questions