Posts

Showing posts from June, 2020

ASP.NET OWIN UseCookieAuthentication Logs User Out After Sign In

I have a need to do manual cookie authentication. As I use OWIN with UseCookieAuthentication middleware, it is not that hard except when I had no idea what is actually required. I know I had to create a ClaimsIdentity and I will need AuthenticationProperties object. Supplying both of them successfully created the cookie, but when I went to a different page, the authentication failed and the application kicked me out to the login page. The following is my initial problematic code in the authentication handler: Dim claims As New List(Of Claim) claims.Add(New Claim(ClaimTypes.NameIdentifier, user.Username)) Dim claimsIdentity As New ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationType) context.GetOwinContext().Authentication.SignIn(New AuthenticationProperties With {      .ExpiresUtc = expiration }, claimsIdentity) For my basic requirement, apparently there are required claims. In my case, I'm missing the Name claim. Adding the following claim solves my iss...

Windows Server 2016 Update Error 0x8007000e

Image
This one server that I managed has not been updated for a while and I happened to need to create a new image out of it, so I thought I might as well update it to the latest via Windows Update. And I ended up spending hours troubleshooting how to update. Windows Update ran into 0x8007000e error when checking for updates. Searching online, some suggested installing Windows Update Troubleshooter or similar tools or update the Windows Update agent. And some people suggested that the OS actually runs out of memory or storage.  My server has 10+ GB of free space and 2GB memory. I thought it shouldn't run out of resources until I read the following articles: https://feedback.azure.com/forums/216843-virtual-machines/suggestions/31407055-low-on-memory-error-server-2016-b-series I follow the suggestion in there to increase the memory to 4GB and it finally updates without issue. I also noticed while the check is running, it consumes about 45% of memory. And the download finally runs, it ...

ASP.NET Web Forms "External component has thrown an exception" Error

Every once in a while, I will get a random error for reasons too time consuming to dig. I have been using Azure DevOps to create CI/CD pipeline to deploy our web application and it has been going well so far. And today, I suddenly got a weird error but it was easily solved. I had no trouble logging in and going to the main page of our web application. But when visiting a particular page, suddenly throws "External component has thrown an exception". I tested it locally and had no problem. And nothing changed on the code of that particular page. Sometimes it can be due to the server runs out of memory and that doesn't appear to be the case this time. This is probably another hiccup I thought. So, I went inside the server and recycle the application pool in IIS. Then, I went back to the browser and reload the page that caused an error and this time it loads without any issue. And the solution this time is simply recycling the application pool.

Error Installing AWS CodeDeploy Agent in Windows Server 2016

It has been a while since I added an EC2 instance to our CI/CD pipeline. And this time, I need to allow a Windows Server 2016 to receive artifacts from AWS CodeDeploy by installing the agent. And installing the CodeDeploy agent is not straight forward. I followed the instructions to install using Windows PowerShell: https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-windows.html#codedeploy-agent-operations-install-windows-powershell It went smoothly until it tried to start the windows service which failed with the following error message: Service 'CodeDeploy Host Agent Service' (codedeployagent) failed to start. Verify that you have sufficient privileges to start system services The error message can be found in the log file which is located at: C:\temp\host-agent-install-log. The following article helps me solving the installation issue: https://github.com/aws/aws-codedeploy-agent/issues/189 Basically, we need to add Windows Defender e...

Azure DevOps Build Failed for Project without Solution File

Image
Our company has been using Azure DevOps as a source control server. Only lately, I have been expanding our usage to take advantage of its CI/CD offerings. It went smoothly until I bumped into a project that has no solution file.  The project without solution file failed the Visual Studio Build task even when it has the same settings as other projects with solution file.  I started by verifying settings from the Solution field. It does says that it can use MSBuild project. Since I was using VB.NET, I point it to .vbproj file. Next is the Platform field, which according to the info bubble, I can specify "any cpu". Last is the Configuration field. Since I want a Release build, I can specify "release" according to the info bubble. The same values, with the exception of the Solution field, work well if I point the task to a solution file but break when I point it to a project file. Part of the error message is: Please check to make sure that you have specified a valid co...