LoginSignup
3
4

More than 5 years have passed since last update.

C#でIISをクラッシュさせる

Last updated at Posted at 2017-09-04

今回は意図的にw3wp.exeをクラッシュさせるプログラムを考えました。

AzureのPaasのCloudServiceでクラッシュダンプの転送をWindows Azure Diagnosticsを使用して行います。
TableStorage、BlobStorageに転送されてくれば成功です。

はじめは少し苦戦して、OutofMemoryの例外を出せばクラッシュすると思いましたが、正常な例外が発生しただけでした。

MVCで作りました。

sample1.cs
public ActionResult Crash()
{
    CrashMethod("HogeHoge---");
    return View();
}
private void CrashMethod(string s)
{
    CrashMethod(s);
}

または、

sample2.cs
async Task<string> GetAsync()
{
    var str = await new HttpClient().GetStringAsync("http://hogehoge.com/");
    return str;
}
public ActionResult Index()
{
    var s = GetAsync().Result;
    return View();
}

結果は、
image.png

image.png

うまくクラッシュダンプを転送させることができました。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4