ASP Provider project failing in Azure environment - session

I'm recently getting a strange error while deploying my Azure application in a new Server. I'm using ASP Providers (supplied by microsoft with Azure SDK code samples). Regardless of several uploads i'm getting this big ugly message. Please help!
Error in '/' Application. --------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Samples.ServiceHosting.AspProviders.<>c__DisplayClass5.<ResetItemTimeout>b__4() in C:\Users\upload.user\Desktop\Deployments\Deployment 2.20_A\AspProviders\TableStorageSessionStateProvider.cs:497
Microsoft.Samples.ServiceHosting.AspProviders.ProviderRetryPolicies.RetryNImpl(Action action, Int32 numberOfRetries, TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff) in C:\Users\upload.user\Desktop\Deployments\Deployment 2.20_A\AspProviders\SecUtil.cs:439
Microsoft.Samples.ServiceHosting.AspProviders.<>c__DisplayClass1.<RetryN>b__0(Action action) in C:\Users\upload.user\Desktop\Deployments\Deployment 2.20_A\AspProviders\SecUtil.cs:395
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +739 System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +114 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +370
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Yes AppFabric Cache is officially released and supported by microsoft. THis link is of great help for tutorial: http://msdn.microsoft.com/en-us/gg457897
However, there's an additional billing aspect to using this approach whereas Tablestoragesessionprovider uses BlobStorage which is peanuts.

The advantage with these samples is that the code is provided so you can generally get a closer look at what's going wrong. I've taken a look and the most likely reason for you getting this error is that there is an error in the configuration of the session state provider (it might be pointing at the wrong account) or the table and container don't exist at that account.
There's a chance that there is just no session object available, but I find that unlikely.
Having said that, the Table Storage Session provider is not suitable for releasing in a production environment. You're much better off either using the SQL Server session provider or the App Fabric cache session provider.

Related

Unable to perform browser authentication in 3DSecure Flow

We are using Global Payments Java SDK to implement 3DSecure. Our web application first calls check-version API on the backend. And our backend use checkEnrollment function of Secure3dService class in Java SDK to check the status of the card. If the card is enrolled, our backend sends the server transaction id (received from Global Payments) back to our web client.
Now, in the second step, our web client gathers all the customer/browser information and calls authentication API on the backend. The backend passes all the mandatory information to initiateAuthentication method of Secure3dService in Java SDK. But the SDK throws 400 error.
We are not able to figure out why we are getting 400 error back.
#update
If we call the checkEnrollment method of Java SDK just before calling initiateAuthentication method of Java SDK, everything works and we get back a successful response with the same request. But we do not want to do that. Because we want to use the old server transaction id for all the subsequent calls instead of generating a new one.
What is the fix of this issue?

Access violation on Server 2012R2 during UAC with custom credential provider

I have a custom credential provider and the credential implements IConnectableCredentialProviderCredential. It is written using Visual C++ 2019 and ATL. It works on Server 2016/2019 and Windows 10/11, if I use it on Server 2012R2, then the UI crashes during UAC--trying to elevate a non-admin user to use an Administrator PowerShell session for example.
I attached a remote debugger and the debugger intercepts the exception consistently as: Exception thrown at 0x00007FFE9E627EC3 (authui.dll) in consent.exe: 0xC0000005: Access violation reading location 0x0000000000000008.
I had some logging/debugging code and I could see that the system never calls my Connect() or GetSerialization() method on the credential when it crashes. My logging showed the username and password getting set, but then after keying the Enter key or clicking on OK, the process crashes without ever asking the credential to serialize its credentials. The logging showed that the last call into my credential provider was to ICredentialProviderCredential::SetStringValue() which was corresponding to entering the password before keying the Enter key.
Since it was throwing an access violation, I assumed that I must be passing bad data back to the system when it was calling the ICredentialProvder::GetFieldDescriptorAt() or possibly the ICredentialProviderCredential::GetStringValue() or some other CredentialProvider::Get...() function. I've gone over the methods with fine tooth comb as well as all other methods and have found nothing. For the GetStringValue() implementation, I am calling SHStrDupW() like in the SDK examples, and for GetFieldDescriptorAt() I am calling the same functions as the SDK examples. In fact, I copied the SDK code.
I decided to distill my credential provider down to a minimal reproducible example. That minimal example is at https://github.com/willcoxson/CredDemo
If anyone could see where I might be passing bad data back in one of the methods, I'd sure be grateful.
IConnectableCredentialProviderCredential have sense only for CPUS_LOGONcase. so for other scenarion your QueryInterface must return E_NOINTERFACE when system ask for IConnectableCredentialProviderCredential
in your concrete case we have CPUS_CREDUI scenario. inside function
void CGetSerializationJob::Do(CREDENTIAL_PROVIDER_THREAD_JOB_CONTEXT const &) system query you for IConnectableCredentialProviderCredential ("9387928b-ac75-4bf9-8ab2-2b93c4a55290" )
and if you return this interface - run next code
system try access some object by pointer - CPLAPCallback::_pSingleton
but pointer is 0. crash exactly at yellow line ( 0xC0000005: Access violation reading location 0x0000000000000008. )

Web API Corruption in Service Fabric

I've encountered two oddities concerning a Web API stateless service in my service fabric cluster. The first regarding missing properties on the response to a call to a stateful service. The second being a critical error when a response to GET was changed from a class to a struct. Details below.
Issue #1 - Missing Properties
I have a three projects:
A class library with a class called Person. The two projects below utilize this library view a private nuget package.
A Stateless Web API, which has a GET to retrieve all Persons.
A Stateful Service, implementing a ReliableDictionary which holds all persons. The Stateless Web API calls a method which returns all person from this dictionary.
The issue is that I've recently updated my class library to give Person some new properties (say, CreatedOn). Both the Stateless Web API and Stateful Service have the latest version of this package and were deployed (overridding, not upgrading). The Stateful Service correctly recognizes and stores these new properties. However, the Web API is somehow not creating an object without those new properties. It's not like they are null, they just simply do not exist!
I've tried uninstalling/reinstalling nuget package, as well as, clearing out bin/obj folders. Neither works. However, creating a new Web API Service fabric project, does work.
Any ideas, or has my project somehow been corrupted?
Pictures of properties:
Issue #2 - Struct Crashing Web API
This may be related to the first issue, and uses the same libraries and services. I tried changing the Person object to a struct, but any call to the api then throws the following error:
{
"Message": "An error has occurred.",
"ExceptionMessage": "The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " at System.Web.Http.Routing.RouteCollectionRoute.get_SubRoutes()\r\n at System.Web.Http.Routing.RouteCollectionRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)\r\n at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.HttpServer.d__0.MoveNext()"
}
Again, trying this in another, identical Web API project works just fine.
Thoughts?
I got same when I used badly formatted route
example
[Route("/api/info")]
correct is
[Route("api/info")]

Intermittent ProviderException from IIS or MVC: API failed due to error 'The data area passed to a system call is too small. '

Running IIS 7.5.7600.16385 on Windows Server 2008 R2 Enterprise (7601: SP1). One of our websites is set to globally log errors and we are seeing this every day or two. We're using an authorization attribute in our web.config that checks for user roles for access and whatever code IIS or MVC uses is generating this error. This is typically being triggered by a single partial view but we also see it triggered occasionally on fetching css or js resources.
System.Configuration.Provider.ProviderException: API failed due to error 'The data area passed to a system call is too small. '
at System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username)
at System.Web.Security.RolePrincipal.IsInRole(String role)
at System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal)
at System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Do we maybe have some IIS setting for our website incorrect? Any idea what is going on? We can see by the username in our logs that the user is being correctly authenticated through IWA.

Error (0x80070542) in website using custom account in application pool

My ASP.NET MVC 3 website was working fine, and then this afternoon I started getting a 500 error, although the only thing I changed was to enable 32-bit applications. I changed that back but the error remains. I've even deleted my app pool and web site and recreated them in IIS with no luck.
If I revert the app pool back to AppPoolIdentity I do not get this error (but I cannot access my database then, I need that custom account to read my database with integrated security).
Can anyone point me in the right direction?
ModuleName IIS Web Core
Notification 2
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 2147943746
ConfigExceptionInfo
Notification AUTHENTICATE_REQUEST
ErrorCode Either a required impersonation level was not provided, or the provided impersonation level is invalid. (0x80070542)
UPDATE:
I enabled impersonation and impersonated a user with admin access to the machine. I received this error in response, which does not tell me much more:
Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
Well, a full uninstall and reinstall of IIS managed to do the trick for me.
I had to follow the instructions here: http://forums.iis.net/t/1170286.aspx in order to do it properly.

Resources