After upgrading to .net6 from .net4.8 FederatedAuthentication.FederationConfiguration does not exists - c#

I just upgraded my .net4.8 web app to .net6 using upgrade assistant among the other errors I get, in my SignIn function I cannot use the following:
WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;
I get the error:
'FederatedAuthentication' does not contain a definition for 'FederationConfiguration'
It seems like FederationConfiguration is no longer supported in .net6. What is the best alternative?

Related

Error : Unable to load DLL 'libgmp-10.dll' when testing azure function c# .net 5.0

I published my c# .NET 5.0 code to azure functions (windows) and im getting this weird error message:
2021-06-21T01:56:53.465 [Error] Executed 'Function1' (Failed, Id=fdefdbba-49a7-44ad-8082-841d2941d90b, Duration=169ms)Unable to load DLL 'libgmp-10.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
I tried to see the \wwwroot files on the azure functions console but then i get this error:
3 [main] ls (8392) C:\Program Files\Git\usr\bin\ls.exe: *** fatal error - Couldn't set directory to \\?\PIPE\ temporarily.
Any hints?
It seems that the deployment is not done correctly.
Libgmp-10.dll a DLL (Dynamic Link Library) file which is referred to
essential system files of the Windows OS. It usually contains a set of
procedures and driver functions, which may be applied by Windows.
Please delete the Azure Function and, re-create and deploy a fresh code using Develop and publish .NET 5 functions using Azure Functions OR if you are using ADO, Setting up a CI/CD pipeline for Azure Functions.
Let me know if you have any follow up questions.

Which Namespace or Nuget Binding BlobProperties in Azure Functions V3

Is there a Nuget/Assembly/Library that will allow me to bind BlobProperties for .NET Core Azure 3.x Functions, in both a local environment and in an Azure environment?
I have an Azure Function running on .NET Core 3 with a signature that looks like this:
public async Task DoFunctionWork([BlobTrigger("path/to/{blobName}")] Stream blobStream,
**Microsoft.Azure.Storage.Blob.BlobProperties Properties**)
{
//Function Body....
}
The problem is with the Properties parameter. If run locally, it can only be resolved if I prefix the BlobProperties parameter with the Microsoft.Azure.Storage.Blob namespace as above. In Azure, it never seems to work. When it fails - on either Azure or locally - I get one of the following messages:
Can't bind properties to type 'Azure.Storage.Blob.Properties' or Can't bind properties to type 'Microsoft.Azure.Storage.Blob.Properties'
Has anyone encountered this before? How did you solve it?
Thanks.
It looks like this is because, there is a version mismatch between what your SDK requires and what you have installed.
For instance, if you are using 3.0.9 version of Function SDK, then you might have installed Microsoft.Azure.WebJobs other than (>= 3.0.0 && < 3.1.0) versions.
Microsoft.NET.Sdk.Functions 3.0.9
Microsoft.Azure.WebJobs.Extensions.Storage 4.0.3

UWP Create App Package fails for release mode

I am trying to create app package for a UWP app (side loading) in release mode it fails with below error. It works fine for debug mode
Severity Code Description Project File Line Suppression State
Error ILT0021: Could not resolve type
'System.Security.SecurityZone' MyApp.ModuleName
Project Properties
When I enable Compile with .NET Native tool chain, I get following error
Severity Code Description Project File Line Suppression State
Error ILT0005:
'C:\Users\username.nuget\packages\runtime.win10-x86.microsoft.net.native.compiler\2.1.8\tools\x86\ilc\ilc.exe
--gatekeeper #"C:\Projects......\obj\x86\Release\ilc\intermediate\gkargs.rsp"'
returned exit code 1 MyApp.Module
When I try to do build on Azure DevOps I get this error
(BuildNativePackage target) -> 2019-02-06T15:14:28.4996296Z
C:\Program Files (x86)\Microsoft
SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.1\tools\Microsoft.NetNative.targets(792,5):
error : ILT0021: Could not resolve type 'System.Security.SecurityZone'
[D:\a\1\s\ProjectFolder\MyApp.ModuleName.csproj]
Update 02/14/2019
Problem was with bunch of Powershell packages I installed from nuget, I removed it all now I am able to create the package. But the package fails to pass App Certification Kit test with the following errors
Windows security features test
FAILED Binary analyzer Error Found: The binary analyzer test detected
the following errors: File C:\Program
Files\windowsapps\myapp.module.subver_1.0.21.0_x64__7p23rrj50tgdp\clrcompression.dll
has failed the AppContainerCheck check.
Supported API test
FAILED Supported APIs Error Found: The supported APIs test detected
the following errors: API sysctl in libc.dll is not supported for this
application type. Microsoft.DotNet.PlatformAbstractions.dll calls this
API. API RtlGetVersion in ntdll.dll is not supported for this
application type. Microsoft.DotNet.PlatformAbstractions.dll calls this
API. API LoadLibraryExW in kernel32.dll is not supported for this
application type. clrcompression.dll calls this API. API
RtlCaptureContext in kernel32.dll is not supported for this
application type. clrcompression.dll calls this API. API
RtlVirtualUnwind in kernel32.dll is not supported for this application
type. clrcompression.dll calls this API. API UnhandledExceptionFilter
in kernel32.dll is not supported for this application type.
clrcompression.dll calls this API. API ExecuteAssembly in uwphost.dll
is not supported for this application type.
MyApp.Subver.exe calls this API. API
DllGetActivationFactory in uwphost.dll is not supported for this
application type. Myapp.subver.exe has an export that
forwards to this API.

.NET - properly deploy and publish [duplicate]

I'm deploying a asp.net core 2.0 website to IIS 10.
I've made sure that my app is using the correct configuration for ISS in the program.settings file.
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
}
And in my startup.cs file:
public void ConfigureServices(IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
});
services.AddMvc();
}
Yet when I run dotnet website.dll from the command line I get the below error message shown in the command line window:
An assembly specified in the application dependencies manifest
(website.deps.json) was not found:
package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1'
path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll' This assembly was expected to be in the local runtime store as the
application was published using the following target manifest files:
aspnetcore-store-2.0.3.xml
Based off the error message, i'm guessing Microsoft.AspNetCore.Antiforgery isn't being bundled when I publish since I do not receive this error when debugging.
How can I ensure that my app can find Microsoft.AspNetCore.Antiforgery when published to a live environment?
EDIT: This is a basic .net core website. No changes have been made to the standard project at this time apart from the above changes for deployment with IIS.
When I run the project from IIS instead of the command line I get a 502.5 error message.
I was able to fix this issue by updating the .net core runtime on the server to v2.0.3.
This issue occurs if
You have an existing server running v2.0.0 of the .net core runtime.
You create an app targeting v2.0.3 of the SDK
You publish the v2.0.3 app to a server running v2.0.0
The issue can be resolved by installing v2.0.3 of the runtime on the server. You can download the runtime from the microsoft site here https://www.microsoft.com/net/download/windows
If you are actually using this library, make sure that your *.csproj file has the corresponding explicit reference:
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="..." />
Then, play with the PublishWithAspNetCoreTargetManifest property to resolve the aforementioned issue with a mismatched manifest.
Check out the following threads to learn more about possible issues while its deployment:
An assembly specified in the application dependencies manifest (RhWeb.deps.json) was not found
published application is missing assembly (missing runtime store associated ...) [2.0.0-preview2-005905]
HTTP Error 502.5 - Microsoft.AspNetCore.Antiforgery.dll
I had this issue - simple workaround, actually install the NuGet package (I wasn't using it).
Microsoft.AspNetCore.Antiforgery
Published, deployed - fixed the issue.
In another case, when I published the project, a lot of the dlls weren't being placed in the publish folder - including Antiforgery. The below appears to force publishing to add all the required dlls.
Edit your projectname.json file to ensure PropertyGroup contains PublishWithAspNetCoreTargetManifest = false:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Interested to know why the above works?!
This also problem happens if Antiforgery is called but Antiforgery is not installed.
Can be fixed by installing Microsoft.AspNetCore.Antiforgery by Nuget package manager.
I fixed this issue on my inhouse windowsserver with this solution
* go to netcore https://github.com/dotnet/core/tree/master/release-notes
* go to the lastest version of the core runtime 2.?
* download DotNetCore.2.0.6-WindowsHosting.exe in my case
https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.6-download.md#net-core-runtime-only-installation
Install this on server and the error was solved for me. Hope this helps anyone.
Got this error after updating Microsoft.AspNetCore.All from v2.0.7 to v2.0.8 (latest at the time) and then publishing to a server that was running .NET Core Runtime v2.0.7 (latest at the time).
Downgraded Microsoft.AspNetCore.All back down to v2.0.7, re-published, and everything works.
If you publish the app as a self-contained ASP.NET Core 2.2 apps as per the linked screenshot (I don't have enough rep for inline image), it will fix this issue.
Self contained:
This can be set when editing your publish settings.
If this issue is related to your Razor mail template, you can add "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation". When I add, the problem is solved.

Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference

When trying to use .net core 2.1 rc1 to add a service reference for WCF, I am experiencing the following error:
Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference
I have checked and the only security in place is Transport, no message security.
The logs are as follows:
[05/24/2018 12:28:28],59,Importing web service metadata ...
[05/24/2018 12:28:28],27,Number of service endpoints found: 2
[05/24/2018 12:28:28],9,Scaffolding service reference code ...
[05/24/2018 12:28:28],71,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet new console --no-restore --force --type project --language C# --output . --name svcutil_starter"
[05/24/2018 12:28:30],9,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet restore --ignore-failed-sources"
[05/24/2018 12:28:31],35,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet "svcutil" --additionalprobingpath "C:\Users\me\\.nuget\packages" "C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\SvcUtilParams.txt""
[05/24/2018 12:28:32],52,An unknown error occurred while invoking the service metadata component.
Failed to generate service reference.
[05/24/2018 12:28:32],11,Done.
As a temporary solution to this issue I have added a new Project to my solution, set it to Asp Core 1.1 and added the connected service that way which appears to work.
It would seem 2.1 is broken currently and I'll have to wait for updates before doing it directly in my Project.
Edit: Thanks to User3130628. This has now been fixed and appears to be working, even in VS 15.7.5.
I suspect the Core framework has been updated and this has corrected the issue.
Till 2018-07-31, it still has problems for NET Core 2.1.x to add a service reference for WCF in VS2017 (v15.7.5). You can create Net 2.0.x project to create the connected service, it'll work perfect. Then copy the 'Connected Services' sub-directory in project to new NET core v2.1.x project.
Installs the following packages via NuGet such as this image:
NuGet Packages for Connected Services
Compiled successfully in NET Core 2.1.x project.
As of today VS2017 15.8.1 it seems to be working again with .Net core 2.1.401
Not sure why this worked for me:
Created second Temp new project targeted to .Net Core 2.0 (in another instance of VS)
Make service reference call (Microsoft WCF Web Service Reference Provider) with .wsdl uri
Open 1st project (target project targetted to .Net Core 2.1) and add the service reference the same way.
Not sure why this worked. Without creating the second solution in a different instance of Visual Studio, it was not working.
Hope this helps.

Categories

Resources