I am attempting to run a .NET 6.0 project locally on my Ubuntu machine using rider. The project using the DefaultAzureCredential class but when I trying running it gives the following error
"DefaultAzureCredential failed to retrieve a token from the included
credentials. See the troubleshooting guide for more information.
https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot\n-
EnvironmentCredential authentication unavailable. Environment
variables are not fully configured. See the troubleshooting guide for
more information.
https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot\n-
ManagedIdentityCredential authentication unavailable. Multiple
attempts failed to obtain a token from the managed identity
endpoint.\n- Operating system Linux 5.19.0-26-generic #27-Ubuntu SMP
PREEMPT_DYNAMIC Wed Nov 23 20:44:15 UTC 2022 isn't supported.\n-
Stored credentials not found. Need to authenticate user in VSCode
Azure Account. See the troubleshooting guide for more information.
https://aka.ms/azsdk/net/identity/vscodecredential/troubleshoot\n-
Please run 'az login' to set up account\n- PowerShell is not
installed."
I tried installing the Azure Cli and using az login which logs me in successfully but that does not resolve the error. I also tried installing the Azure Toolkit in rider and signing in through that with a 'device code'. Again that works successfully but when running the application I still getting the same issue.
This same project work fine using rider or visual studio in Windows, so it seems to be something about this class being unable to consume credentials on my Linux machine that is not a problem when using a Windows.
Related
I probably have a setup problem on IIS (it's a web server with real URL domain, so accessible from external at any time). I have created a Web API with minimal API NET 7. Before testing out authetification, I tried to reach an endpoint first. I named this endpoint /api/test and defined it as [AllowAnonymous]. On the development server via Swagger everything is already running (also the login or generation of tokens). But in the release web api version I commented out Swagger.
Now when I install the web app on IIS server, then when I call the app via IIS server (but also when I enter the address in browser itself) I get the message: HTTP Error 404.0 - Not Found
Detailed error information is:
Module: IIS Web Core
Notification: MapRequestHandler
Handler: StaticFile
Error code: 0x80070002
Requested URL: http://api.testapp.com:64591/api/test
Physical path: C:\inetpub\wwroot\Testapp\api\test
Login method: Anonymous
User login: Anonymous
Most likely causes:
The specified directory or file does not exist on this web server.
The URL contains a spelling error.
Access to the file is restricted by a custom filter or module such as URLScan.
But if I run the app in the console via dotnet Testapp.dll, then it is started and if I then enter the URL http://localhost:5000/api/test in the browser, then I get the data.
So it can only be that something has gone wrong with the IIS App setup. By the way I also have ASP.NET Core 7.0 Runtime (v7.0.1) - Windows Hosting Bundle installed. When setting up the app on IIS I used the following guide: http://www.technical-recipes.com/2018/running-asp-net-web-api-services-in-iis/
Can anyone help me with any suggestions?
Thanks
EDIT
Following Lex's suggestion (see his comment below), I installed the Jexus Manager software and ran diagnostics. Here is the report:
IMPORTANT: This report might contain confidential information. Mask such before sharing with others.
System Time: 15.12.2022 10:18:45
Processor Architecture: AMD64
OS: Microsoft Windows NT 10.0.17763.0
Server Type: IIS
Scan 28 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 (17.0.22323.1).
Scan 44 registered handler(s).
No valid ASP.NET Core handler is registered for this web site.
To run ASP.NET Core on IIS, please refer to https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index for more details.
EDIT 2
I am getting a little closer to the issue. The fundamental error was that I used the app files from the release folder and not from Publish!
I have now copied the app correctly and when I start the app in IIS, browser opens and I can request the data via the Api link!
So locally on the server it works, the problem I have now is that it does not work from external. I get the message:
ERR_CONNECTION_TIMED_OUT
The message also appears in the MAUI application which should use this web api:
A connection attempt failed because the connected party did not respond properly after a period of time, or established connection failed because connected host has failed to respond. (api.website.com:64500)
I started Diagnostic Tool again and I get the following output:
IMPORTANT: This report might contain confidential information. Mask such before sharing with others.
System Time: 15.12.2022 10:33:27
Processor Architecture: AMD64
OS: Microsoft Windows NT 10.0.17763.0
Server Type: IIS
Scan 28 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 (17.0.22323.1).
Scan 45 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.24.28127.4 built by: vcwrkspc): C:\Windows\system32\msvcp140.dll.
The application pool 'WebApplication1' is used.
Pool identity is IIS AppPool\WebApplication1
Please ensure pool identity has read access to the content folder C:\inetpub\wwwroot\WebApplication1.
Pool bitness is 64 bit
Scan aspNetCore section.
"processPath": dotnet.
"arguments": .\WebApplication1.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 C:\inetpub\wwwroot\WebApplication1\WebApplication1.runtimeconfig.json.
Runtime is 7.0.0.
Now it works. If someone else has similar problems (Minimal Api application under NET 7 on IIS), then here are a few tips:
if you release the application, you have to do it via Publish (because e.g. also Web-Config is under Release not generated)
.NET Core Hosting Bundle must be installed on the IIS server.
make sure to open the required ports under Firewall, otherwise external access is not possible
if there should be problems then it makes sense to install the app Jexus Manager and use diagnostic tool in the app.
So, hope I have not missed anything.
I’m running Visual Studio 2019 with the AWS Explorer installed with a profile on an Amazon Workspace. Until today, I’ve been able to debug Lambda projects locally using the AWS .NET Core 3.1 Mock Lambda Test Tool. Today, I needed to do some CLI work and noticed the CLI wasn’t installed so I installed the latest version. After installing, my code fails when trying to access any AWS service with the error:
Unable to get IAM security credentials from EC2 Instance Metadata
Service.
I’ve verified that my credentials file is correct at /.aws/credential and that AWS Explorer is picking that up and I can browse services and objects in the AWS Explorer.
I’ve deleted the credential file and recreated using aws configure. No change.
I’ve deleted the credential file and recreated using the AWS Explorer. No change.
I’ve uninstalled and reinstalled the AWS CLI and AWS Explorer and recreated the profile. No Change.
I’ve set windows environment variables for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. This works.
Obviously, I can hard code my access key and secret into my client when I create it and that works.
The question is, why won’t my code pick up the credentials from my /.aws/credentials file? Anything else I can try?
You need to confirm what "the default" location for your credentials file is that AWS SDK is using. This is what AWS SDK considers the default base directory:
var baseDirectory = Environment.GetEnvironmentVariable("HOME");
if (string.IsNullOrEmpty(baseDirectory))
baseDirectory = Environment.GetEnvironmentVariable("USERPROFILE");
Just dump the runtime values and either place a copy of your .aws folder there or use the app setting
"AWS": {
"AWSProfilesLocation": "C:\\Users\\YOUR_USER_NAME\\.aws\\credentials",
....
to point the SDK to the credentials file.
I have an asp.net core 1.1.1 web application that runs properly from IIS Express. After I deploy it to Azure the web app cannot start. I get the following error:
An error occurred while starting the application.
.NET Framework X86 v4.0.30319.42000 | Microsoft.AspNetCore.Hosting version 1.1.1 | Microsoft Windows 6.2.9200
I have removed almost everything from Startup.cs and turned on all the debugging possibilities I know about. The only errors I can get is in eventlog.xml:
Warning: Could not create stdoutLogFile \\?\D:\home\site\wwwroot\logs\stdout_6624_201732620236.log, ErrorCode = -2147024893.
.NET Runtime version 4.0.30319.0 - Loading profiler failed. Failed trying to receive from out of process a request to attach a profiler. HRESULT: 0x8007006d.
I assume it is some permission problem, but I have no idea where and how to set permissions on Azure file system.
Please help me, I am pulling my hair out. I am sitting here for hours solving this.
Thanks.
I managed to solve the problem myself and I hope this solution might help someone.
The problem was with configuration of external authentication providers. As it was suggested I set the app secrets by using the Secret Manager Tool, however I did not set up the variables after deployment to Azure.
I think it is somehow misleading that there is a Authentication / Authorization section on Azure Web App Settings. I set the secrets there properly. I only realized afterwards, that the settings should be at the Application settings section as regular App setting key value pairs.
I've been trying for days to migrate our backend solution running on Azure 2.6 and Azure Cloud Services to Azure 2.7 in VS2015 on Windows 10 workstation, but without any luck.
I've tried on multiple computers using a clean install of Windows 10 Pro x64 with Visual Studio 2015 Enterprise (all features installed).
All updates available in both Windows Update and Vs2015 are installed.
I create a new Cloud Service solution, with one Empty web role.
I've set VS2015 to break on "Common Language Runtime Exceptions" (Debug -> Windows -> Exception Settings).
I've run into the same errors on a separate machine running Win 8.1, VS2015, Azure 2.7.
The solution compiles fine but when I try to run/debug the Cloud Service project it throws the following error:
Exception thrown: 'System.Security.SecurityException' in mscorlib.dll
Additional information: Requested registry access is not allowed.
Starting only the WebRole without using the CloudService works.
When I try to run the CloudService through VS2015 with administrator priviliges the following exception is thrown:
'System.Threading.WaitHandleCannotBeOpenedException' in mscorlib.dll
Additional information: No handle of the given name exists.
Publishing the compiled solution to Azure yeilds the same exception when inspecting the intellisense logs ("Requested registry access is not allowed").
I've tried to add the install.cmd script from this blog post to install 4.5.2 or 4.6 on Azure Cloud Service when deploying but without any change in result: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-install-dotnet/
Are Cloud Services compatible with Azure 2.7?
-- UPDATE: Yes. Make sure you use .Net framework v4.5.1
Is the install.cmd script really needed when running in local debug mode? Both 4.5.2 and 4.6 should already be installed, right?
Anyone else experiencing problems with this?
Any help or hints on how to get Cloud Services to work with Windows10, Vs2015 and Azure 2.7 are greatly appriciated!
Here is a repo with a sample project: https://www.dropbox.com/s/ie7jcn932nsddio/CloudServiceRepo.zip?dl=0
If your underlying cause is the same as mine, I have a workaround (if not an actual cause and solution)
Add this under the runtime -> assemblyBinding section of the app.config for your worker role:
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.7.0.0" newVersion="2.7.0.0" />
</dependentAssembly>
Here's how I arrived at this. In VS2015 with SDK 2.7, I created a brand-new, empty cloud service. I pulled in my existing worker role, which was created with SDK 2.6 and upgraded to 2.7. This time, I got a new error complaining that it could not find Microsoft.WindowsAzure.Diagnostics version 2.6. In my worker role, my assembly reference is for version 2.7, not 2.6. So, something in the worker role (which I cannot find or understand) still wants version 2.6 of this assembly. Bad upgrade by the SDK? Dunno. Anyway, by adding this entry in the app.config, I force it to use version 2.7 instead.
I don't know why I get a different (and more accurate) error message when I create a new cloud service, versus using the old one. I also don't know what this has to do with the original "WaitHandle" error, but perhaps that was a red-herring, and the original problem has always been a version mismatch? I'd like to know what caused this problem and what the proper long-term solution is, but I'll settle for this workaround for now.
Good luck, I hope this works for you as it did for me.
I am newbie in Microsoft Azure so I tried to create some easy chat for learning purpose. I found nice tutorial:
http://www.asp.net/signalr/overview/performance/scaleout-with-windows-azure-service-bus
I did everything as it is in this sites.
When I try to deploy project on server, I get error:
The file provided is not a valid service package. Detailed error code: TestWebRole Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
So I was looking for IISConfigurator.exe file in computer and I found it in that project. It's in path:
projectName/csx/Release/roles/projectName/base/x64/IISConfigurator.exe.
This file exists but it's on wrong place most likely.
I tried to put it all over the places in project, but nothing changed.
I tried to put it in system path, but this didn't help as well.
I am currently using Visual studio 2013 Community edition with admin rights.
Whole history for deploy:
16:40:22 - Applying Diagnostics extension.
16:40:42 - Preparing deployment for TestProject - 3. 4. 2015 16:40:14 with Subscription ID '9ca25534-0b9c-4b17-b259-e32d19977b7a' using Service Management URL 'https://management.core.windows.net/'...
16:40:42 - Connecting...
16:40:42 - Verifying storage account 'wa2chatstorage'...
16:40:42 - Uploading Package...
16:40:48 - Creating...
16:41:19 - The file provided is not a valid service package. Detailed error code: TestWebRole Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
I saw this issue as well, but with a much scaled down version of what you're trying to do.
https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
I installed the latest SDK (2.7) and the PowerShell updates and it worked like a charm. Hope that helps!
I had an issue in our TeamCity servers with that error message in it:
Set-AzureDeployment : BadRequest : The file provided is not a valid service package. Detailed error code: [MyProject] Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
The fix for me was to uninstall Microsoft Azure Authoring Tools - v2.9.6 and Microsoft Azure Authoring Tools - v2.9 from the build agent (which removed "C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\runtimes\base\x64\IISConfigurator.exe"), and then reinstall the Microsoft Azure Authoring Tools - v2.9 from the Windows Azure SDK for .NET - 2.5 download.