Edi Wang

Microsoft MVP for Azure

Server and Tools Server, Software Tips and Tricks

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

Install Linux Subsystem on Windows 10 Fall Creators Update

In the recent Windows 10 v1709 Fall Creators Update, the Windows subsystem for Linux has been improved a lot. Let's see how easy it is now to install Linux on Windows. 1. Enable Windows Subsystem for Linux Because the classic control panel has been hidden, now the quickest way to access Programs and Features is to run appwiz.cpl And then check "Windows Subsystem for Linux" under "Turn Windows …
Windows Linux

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

Run Scheduled Tasks in ASP.NET Application

在ASP.NET里运行定时任务,这是个老生常谈的话题了,撇开那些用per request搞定屌丝办法,目前最好的解决办法只有2种: 1. 如果你有大微软的Azure,可以直接在网站服务中找到Jobs,自己看一下就会了 2. 如果你是屌丝,买不起Azure,就用本文介绍的WebBackgrounder搞 由于ASP.NET是服务器端Web框架,所以一般而言,一个操作的往往是只有收到客户端Request之后才能执行的,如果网站一直没人访问,没有Request进来,如何执行代码呢?定时任务就是这种坑爹场景。 还好,大微软的MVC帝、ASP.NET小王子haacked蜀黍给我们写了个 http://www.nuget.org/packages/WebBackgrounder/ 专门捣鼓这种场景。作为一个屌丝程序猿,和大牛的区别就在于“好编程,不求甚解”。所以我们不必在意它是怎么实现的,只要会用就行 …
ASP.NET Jobs

简单粗暴有效解释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