Edi Wang

.NET and Azure Developer

IIS

ASP.NET Core 5.0 Throughput Test in Kestrel, IIS, Nginx and Caddy

Starting from version 2.2, ASP.NET Core allow you to use the InProcess mode to improve performance under IIS. Rick Strahl has a detailed article on this. Three years have passed, and now ASP.NET Core has reached version 5.0, how the performance diffs between servers? Let's take a look together. Rick's Test Result In the original article, Rick Strahl tested the performance of ASP.NET Core 2.2 in …
ASP.NET IIS Linux

How to Enable Application Request Routing on Azure App Service

We typically use Application Request Routing (ARR) module to host a reverse proxy on IIS. Azure App Service is also using IIS as it's gateway, which should work for reverse proxy, but it won't work by default. Let's see how can we enable ARR on Azure App Service. The Experiment I have https://dropdatabase.run/ domain, and I want to reverse proxy https://996.icu/ under https://dropdatabase.run/996. …
IIS Azure App Service

Run Classic ASP on Windows 10 and Azure App Service

ASP is an old technology of Microsoft that even before .NET was born. I have used ASP 3.0 to create my first personal blog in 2003. Nowadays, it is hard to find ASP web applications still active on the internet. But we can still bring the 1996's classic ASP back to life on today's Windows 10 and even in Azure. Some history ASP and its successor, ASP.NET are completely different. ASP uses the …
ASP IIS Azure

Path Caveat with ASP.NET Core 2.2 IIS Hosting

ASP.NET Core 2.2 has been in place for some time, with a new feature that can use the new AspNetCoreModuleV2 and deploy with InProcess mode on IIS to dramatically improve performance. These days Azure App Service finally completed the deployment of this new version of the module, I configured my blog to the new module, and it exploded in production. Let's see why and how to solve it. If you don't …
.NET ASP.NET IIS

Prevent Image Hotlinking in ASP.NET/Core Applications

Introduction As a website developer, we sometimes don't want the images on our own website to be directly referenced and showed on other's website. It can cause a lot network bandwidth for our datacenters in some cases, which means costing money for us to pay for the one who use our images. For example, your website is A.com, you have an image on http://a.com/facepalm.jpg and B.com used your …
.NET ASP.NET IIS

How to Redirect Old Domain URL to New Domain in IIS

When you change the domain name for your website, you are definitely going to solve the migration problem. You cannot just stop DNS on your old domain, because this will cause your indexed pages to be deleted by search engines. The correct way is to tell the search engine that you have a new domain name now, which is when the user accesses an old URL, redirect it to the new URL. Take my blog …
IIS URL URL Rewrite

How to Manage Azure App Service in IIS Manager (inetmgr)

The website we created on Azure seems can be only managed in the web portal or in the Server Explorer of Visual Studio. If we would like to use IIS to manage more powerful scenarios, seems VM is the only way. But that's not true. First, the IIS comes with Windows 8.1 can't connect to Azure by default. We need to install an extension http://www.iis.net/downloads/microsoft/iis-manager After install. …
IIS Azure

Azure Website Showing 404 for .woff Fonts in IE

If you are using Website on Microsoft Azure (Currently renamed to Web Apps), you will find the .woff web font is not working in IE, it returns 404. Based on my experience, this is because IIS is not configured to use the correct MimeType. However, we can not operate the IIS on Azure, there's no RDP into an Azure Web Apps backend machine. How can we do that? In fact, after IIS7, the MineType is …
IIS Azure

Get Clear Password from IIS App Pool

Sometimes, in order to get necessary permissions, we will assign domian accounts or local accounts for IIS app pool. For example, it usually happens for SharePoint deployment. However, this is not a secure way, because the password for these accounts are saved in clear text. For local accounts, the password is not readable. But if you are using domain accounts. The IIS Admin can read your …
IIS Security

简单粗暴有效解释ASP.NET中的线程池是怎样处理Http请求的

自从有了.NET 4.5,我们又多了一个装逼语法:async,await。但如果错用就会装逼不成反变傻逼。首先我们得明白在ASP.NET中async await所针对的问题,这样才能正确的装逼。于是我们就不得不先研究一下线程池。 在IIS服务器上,处理Http请求的是线程,和Windows的其他软件一样,干活的永远是线程,而不应该说是进程。一个线程同时只能处理一个request,而web上的request不可能同时永远只有一个,所以线程需要和他的小伙伴们一起组成线程池,才能保证网站的响应。当一个线程处理完了手头的请求,它就被释放掉了,于是如果再有新的请求进来他就能再去处理。但如果当线程用完了,并且他们正在处理的请求都没完成,网站就卡住了,用户就只能等出翔。这时候IIS就会返回一个HTTP 503爆给用户。 打个比方,IIS服务器就好像银行,Http请求就好像顾客,银行开的窗口数量就是进程池 …
IIS Async Async Await Thread