Skip to main content

Posts

Showing posts from 2019

Step by step guide to fix Angular app refresh issue in IIS

If you deploy your Angular app in IIS, routing will be handled from the client. So when you refresh a page it will give you 404 error. To get ride of the above-mentioned situation we have to follow the steps as follows: Before deploying anything on IIS, you have to install the URL Rewriting module on the IIS server. Please refer the link. After the installation, you should be seeing the following icon. If you are above to deploy an Angular app when is developed with ASP.Net Core. That deployment steps are explained in my previous blog post . That blog spot explains one issue I came across when I was deploying Angular 7 App with ASP.Net Core in IIS. So now we are done with IIS side installation next, we have to check the deployment files. You have to make sure that web.config file. web.config should contain the followings: <?xml version=”1.0" encoding=”UTF-8"?> <configuration> <system.webServer> <rewrite> <rules>

Generic Repository with Entity Framework Core

Recently I worked on a project with ASP.NET Core which uses Entity Framework Core. With them, I used a generic repository pattern in the data layer. Repository interface was like below: using System; using System.Collections.Generic; using System.Linq.Expressions; using OnlineSurvey.Models; namespace OnlineSurvey.Data { public interface IRepository<T> where T : BaseEntity { T GetById(int id, params Expression<Func<T, object>>[] includExpressions); void Add(T entity); void Delete(T entity); void Delete(int id); IEnumerable<T> GetAll(params Expression<Func<T, object>>[] includExpressions); IEnumerable<T> Find(Expression<Func<T, bool>> where); int Count(); } } And the implementation was like below: using System; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Collections.Generic; using Syste

An error occurred while starting the application in ASP.NET Core on IIS

I got this following error when I hosted my ASP.NET Core 2.2 web API on IIS. An error occurred while starting the application. .NET Core 4.6.27317.07 X64 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 (Please ignore the version numbers. Just wanted to show the error as it was.) So my first step was to change the  stdoutLogEnabled=true in web.config,  but couldn't find the logs folder. Few mins later I learnt that the  AspNetCoreModule   doesn’t create the logs folder for you by default (Hope they will fixed soon). It logs the error to the Event Viewer which says: Warning: Could not create stdoutLogFile  Path\logs\stdout_xxxxx.log, ErrorCode = -2147024893 . So, I created the the logs folder manually and here I find the real reason why it is failing. Hope this will help you guys.

503 Service Unavailable when deploy ASP.NET CORE 2.2 Angular 7 app in ISS

Currently, I'm working on an ASP.NET CORE 2.2 based project. So, I wanted to host in IIS, which is on Windows Server 2012 R2 system. So, I followed the following steps: Installed the latest version of . NET Core Runtime & Hosting Bundle for Windows. Which you can find in this. Created the application pool with .NET CLR Version: No Manged Code Then created the web application pointing to that application pool. But it was not working, and it started giving me 503 Service Unavailable error. The most important thing is, it was not only for this the web application that I created, but it was also for all the application hosted in this server. When I investigated more I found the following error in Event Viewer: Error logged in Event viewer After looking around for some time, I came to know that the ASP.NET Core/.NET Core: Runtime & Hosting Bundle (latest versions) depends on Microsoft Visual C++ 2015 Redistributable . Even while install