SEHException while running azure project - c#

I have just moved my azure project from sdk version 1.4 to 2.1.
After this move, I am having trouble starting the azure roles on my local machine. I get the following error:
[SEHException (0x80004005): External component has thrown an exception.]
RdGetApplicationConfigurationSetting(UInt16* , UInt16** ) +0
RoleEnvironmentGetConfigurationSettingValueW(UInt16* pszName, UInt16* pszDest, UInt32 cchDest, UInt32* pcchRequiredDestSize) +82
Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(String name, String& ret) +232
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +67
Surfmark.MVC.WebRole.FirstRequestInitialization.ApplicationStartUponFirstRequest(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:232
Surfmark.MVC.WebRole.FirstRequestInitialization.Initialize(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:223
Surfmark.MVC.WebRole.MvcApplication.Application_BeginRequest(Object sender, EventArgs e) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:202
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Please note that I am making a call to RoleEnvironment.GetConfigurationSettingValue() in the Application_BeginRequest() method in Global.asax. While using v1.4 of Azure SDK, I used to call CloudStorageAccount.SetConfigurationSettingPublisher() in the Application_Start() so that getting the configsetting doesnt error out. I notice that in v2.1 this method is no more there, so I am assuming I can access RoleEnvironment.GetConfigurationSettingValue() without error.
Please let me know what am I doing wrong here?
Thanks
Kapil

I think I figured this out. Actually I was upgrading my proj from 1.4 to 2.1 version od azure SDK. Now, I noticed that my proj was using full IIS to start the compute emulator on dev machine. I moved that to IIS-express (seems like thats the default for dev emulator in the new SDKs) and things seem to work well.
Thanks
Kapil

Related

Firestore functionality on a Windows iot core: error loading native library grpc_csharp_ext.x86.dll

Relatively new to the windows ecosystem. After following the windows documentation on setting up a background application on iot and google's quickstart for C#, I am receiving this error that I cannot seem to solve:
System.IO.IOException: 'Error loading native library "C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\BackgroundAppFirestoreOne-uwpVS.Debug_ARM.usernoname\grpc_csharp_ext.x86.dll". '
Stack Trace:
System.IO.IOException
HResult=0x80131620
Message=Error loading native library "C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\BackgroundAppFirestoreOne-uwpVS.Debug_ARM.usernoname\grpc_csharp_ext.x86.dll".
Source=Grpc.Core
StackTrace:
at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary()
at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
at Grpc.Core.Internal.NativeExtension..ctor()
at Grpc.Core.Internal.NativeExtension.Get()
at Grpc.Core.GrpcEnvironment.GrpcNativeInit()
at Grpc.Core.GrpcEnvironment..ctor()
at Grpc.Core.GrpcEnvironment.AddRef()
at Grpc.Core.Channel..ctor(String target, ChannelCredentials credentials, IEnumerable`1 options)
at Grpc.Core.Channel..ctor(String host, Int32 port, ChannelCredentials credentials, IEnumerable`1 options)
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(ServiceEndpoint endpoint, IEnumerable`1 channelOptions, ChannelCredentials credentials)
at Google.Api.Gax.Grpc.ChannelPool.GetChannel(ServiceEndpoint endpoint, IEnumerable`1 channelOptions)
at Google.Cloud.Firestore.FirestoreDb.Create(String projectId, FirestoreClient client)
at BackgroundAppFirestoreOne.StartupTask.<Run>d__4.MoveNext() in C:\Users\usernoname\source\repos\BackgroundAppFirestoreOne\StartupTask.cs:line 95
The file is in the directory and does have the necessary permissions.
My environment:
Developing on Windows 10 with Visual Studios 2019 Enterprise
Deploying to a Dragonboard 410c with Windows 10 iot Core
Google.Cloud.Firestore NuGet referenced
I've tried:
Adding the gRPC.core as this suggested, as a NuGet package reference in VS2019, this did not solve the issue.
And I don't have any non-English characters as this suggests.
This error occurs when attempting to execute FirestoreDb db = FirestoreDb.Create(project);
(see line 44 of sample)
Does anyone know what this could be / what I could try to rectify?
I did not encount the exception with Google.Cloud.Firestore 1.1.0 on Windows IoT Core 17763. Could you please check the package version and OS version. BTW, it is not recommended to use the package in background app, since at the moment you can't register a headless app that uses filetypeAssociation, so that the app can not access the credential file(.json).

Getting "Unrecognized SameSiteMode value -1" InvalidOperationException in ASP.NET Core 3.1 Web Application

I'm running some tests to prepare for the upcoming Chrome version with the changes to SameSite handling of cookies, but my web application is giving trouble. I can reproduce it in the following way:
Use Visual Studio 2019 (16.4.3) to create a new project.
Pick "ASP.NET Core Web Application" and enable https.
Add a "Scaffolded Item" and add ASP.NET Core Identity.
When asked, scaffold all files, and add a fresh data context and user, using SQLite:
Add services.AddRazorPages(); to Startup
Add endpoints.MapRazorPages(); into the UseEndpoints configuration lambda
Add the SameSiteCookiesServiceCollectionExtensions as suggested by ThinkTecture and use it by adding services.ConfigureNonBreakingSameSiteCookies(); to your Startup. Alternatively, just leave out the browser sniffing part (not needed for this repro I think), skip copying linked solution, and instead do this:
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = (Microsoft.AspNetCore.Http.SameSiteMode)(-1);
});
Add app.UseCookiePolicy(); to Startup to enable the code
Start the application (for me it starts in IIS Express on https://localhost:44342/)
Navigate to https://localhost:44342/Identity/Account/Login
The result for me is:
An unhandled exception occurred while processing the request.
InvalidOperationException: Unrecognized SameSiteMode value -1
Microsoft.AspNetCore.CookiePolicy.ResponseCookiesWrapper.ApplyPolicy(string key, CookieOptions options)
The full stack trace, should it be important:
InvalidOperationException: Unrecognized SameSiteMode value -1
Microsoft.AspNetCore.CookiePolicy.ResponseCookiesWrapper.ApplyPolicy(string key, CookieOptions options)
Microsoft.AspNetCore.CookiePolicy.ResponseCookiesWrapper.ApplyAppendPolicy(ref string key, ref string value, CookieOptions options)
Microsoft.AspNetCore.CookiePolicy.ResponseCookiesWrapper.Append(string key, string value, CookieOptions options)
Microsoft.AspNetCore.Authentication.Cookies.ChunkingCookieManager.AppendResponseCookie(HttpContext context, string key, string value, CookieOptions options)
Microsoft.AspNetCore.Authentication.Cookies.ChunkingCookieManager.DeleteCookie(HttpContext context, string key, CookieOptions options)
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleSignOutAsync(AuthenticationProperties properties)
Microsoft.AspNetCore.Authentication.AuthenticationService.SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
AuthTest.Areas.Identity.Pages.Account.LoginModel.OnGetAsync(string returnUrl) in Login.cshtml.cs
+
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+NonGenericTaskHandlerMethod.Execute(object receiver, object[] arguments)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
If I check dotnet --info I see:
Host Version: 3.1.1
.NET Core SDKs installed: a whole bunch, up to and including 3.1.100 and 3.1.101
Several .NET Core runtimes installed including Microsoft.AspNetCore.App versions 3.1.0 and 3.1.1
Some additional details and attempted workarounds:
csproj contains <Project Sdk="Microsoft.NET.Sdk.Web"> that should (as far as I know) use the latest stuff available
I've rebooted to make sure there is no transient problem lingering
one colleague with a Windows machine, can reproduce the problem
another colleague, with a Linux Mint machine, does not have the problem
I've tried dotnet nuget locals all --clear but it didn't help
I can see the error line in the 3.0.0 sources but not in the 3.1.0 sources (or master) of ASP NET Core
I have tried dotnet new globaljson --sdk-version 3.1.101 to force the right version, but it didn't work (though I'm not sure if that's the right way to go about using one)
I want to try to remove specific versions from my machine but I run into problems uninstalling things (apart from the fact that the Version Selection features should render that approach unnecessary, right?)
So I presume I'm facing a variant of this ASP.NET Core GitHub issue that mentions my version is too low? But I'm not sure how to proceed now, since I feel I already cleared everything.
What am I missing here? What do I need to do to fix this?
Turns out this happens if you do not pay attention and pick 3.0.x in the Visual Studio dialogs for creating the application. If you pick the right one (3.1.x) you will get:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
in your .csproj file, as well as 3.1.x versions of several packages instead.
Not sure why Linux would specifically not have the issue, maybe it's just that those machines coincidentally don't have 3.0.x versions of dotnet core available or installed, and it runs your code against 3.1, thus obscuring the problem?
Many possibilities have been tried to try.
But the solution is this:
You have to install this. ASP.NET Core Runtime 2.1.17

ASP.NET HttpHandler error after Windows 10 Fall Creators Update

A couple of days ago my Windows 10 development machine got the Falls Creators Update.
Since then every attempt to register a custom HttpHandler in any ASP.NET Web Site (not web application) fails with error:
Failed to map the path '/App_GlobalResources/'.
The stack trace is:
[InvalidOperationException: Failed to map the path '/App_GlobalResources/'.]
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath,
Boolean permitNull) +8965114
System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) +42
System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate2
(StandardDiskBuildResultCache diskCache) +295
System.Web.Compilation.BuildManager.CheckTopLevelFilesUpToDate
(StandardDiskBuildResultCache diskCache) +55
System.Web.Compilation.BuildManager.RegularAppRuntimeModeInitialize() +174
System.Web.Compilation.BuildManager.Initialize() +238
System.Web.Compilation.BuildManager.InitializeBuildManager() +267
System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags) +224
[HttpException (0x80004005): Failed to map the path '/App_GlobalResources/'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9002835
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333
I am using Visual Studio 2015 with the integrated IIS express. I have some old asp.net web sites (.net version 2.0) that used to work. Now, even the following example does not work:
App_Code/MyHandler.cs:
public class MyHandler : IHttpHandler
{
public MyHandler()
{
//
// TODO: Add constructor logic here
//
}
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/html";
context.Response.Write("Hello");
}
}
web.config:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<add name="MyHandler" verb="*" path="*.htm" type="MyHandler"/>
</handlers>
</system.webServer>
</configuration>
I really cannot understand what is happening and I've run out of ideas and patience. Please, help. TIA.
I've decided to follow #Hamlet Hakobyan's suggestion and uninstall Windows 10 Fall Creators Update.
Let me tell you right away that the problem is now fixed.
Here is my development setup in case someone faces the same situation:
Windows 10 build 1709 (Fall Creators Update)
Visual Studio Community 2015 Update 3
ASP.NET Web Site project (not web application project)
.NET framework version 2.0
IHttpHandler implementation in .cs file in App_Code folder.
Http handler registration in web.config for IIS Express running in Integrated Mode as per: https://msdn.microsoft.com/en-us/library/46c5ddfy.aspx
If your http handler(s) stopped working after having installed the Windows 10 Fall Creators Update and you receive the not-so-useful error below:
Failed to map the path '/App_GlobalResources/'.
then go ahead and revert to previous Windows 10 build (1703).
Hope it helps.

Problems connecting to data folder using sage sdo18.(ForwardCallToInvokeMember)

I'm developing an automatic invoicing system using c#.net v4.0 and Sage's SDO. The Application works fine on my local machine both in a development environment and on iis 7. I am now trying to implement it on a live server and I am getting the following error:
SAGE EXCEPTION:Not connected to Data Source - Connect or Logon failed .
Error Code:sdoNotConnected
StackTrace: at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at SageDataObject180.IWorkSpace.CreateObject(String Name) at RestrictedPages_ViewReport.GenerateInvoice(Object sender, EventArgs e) in c:\inetpub\wwwroot\IE Support Manager Integration\RestrictedPages\ViewReport.aspx.cs:line 386
The iis7 process is running on a 32 bit process. The folder is hosted on a machine on the network but not on the machine that the web application is installed on. I can read and write to this folder from the web application so I doubt its a permissions problem.
I've been tearing my hair out with this problem for 2 days now so any help would be much appreciated!!
Can you post the actual code where the error is happening? I am guessing its permissions or a variable that needs changing.

ClickOnce Windows Forms application is throwing an exception on attempt to update via CheckForDetailedUpdate()

I have a Windows Forms ClickOnce application that performs its own application updates. This has been working fine for several years, however, a recent deployment is producing the following exception:
Message: Object reference not set to an instance of an object.
Source: System.Deployment
Target Site: System.Security.Policy.ApplicationTrust RequestTrust(System.Deployment.Application.SubscriptionState, Boolean, Boolean, System.ActivationContext, System.Security.Policy.TrustManagerContext)
Stack Trace: at System.Deployment.Application.ApplicationTrust.RequestTrust(SubscriptionState subState, Boolean isShellVisible, Boolean isUpdate, ActivationContext actCtx, TrustManagerContext tmc)
at System.Deployment.Application.DeploymentManager.DetermineTrustCore(Boolean blocking, TrustParams tp)
at System.Deployment.Application.DeploymentManager.DetermineTrust(TrustParams trustParams)
at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate(Boolean persistUpdateCheckResult)
at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate()
at SCANit.Inventory.ClickOnce.CheckForDetailedUpdate()
at SCANit.Inventory.AppUpdaterService.StatusOfUpdate(Boolean notify)
at SCANit.Inventory.AppUpdaterService.PerformAppUpdate()
at SCANitApp.MainApplication.updateMenuItem_ItemClick(Object sender, ItemClickEventArgs e)
My attempts to search the error reveals it's possibly due to an expired certificate, .pfx. However, I generated a certificate with a long expiry date. I did a diff in Git on the previous deployment's .pfx and application .csproj and see no real differences. What might be happening here?
My apologies, I found a difference in the .csproj file I did not catch before:
<PlatformTarget>x86</ PlatformTarget>
This seems to have fixed it when changing to AnyCpu for the application.

Categories

Resources