使用Visual Studio Profiler測試host在本地IIS上的WCF服務性能

發表于:2012-01-09來源:博客園作者:Mike Dos Zhang點擊數: 標簽:
讀過上篇bolg的現在應該知道怎么樣來Profile一個WCF項目了,今天我們來看一下怎樣Profile一個host到本地IIS上的WCF服務,我們還是使用Visual Studio 2010還有上篇blog中的測試項目。 使用Administrator賬戶啟動Visual Studio 2010!

  http://www.cnblogs.com/telnet_mike/archive/2011/11/07/2240351.html

  讀過上篇bolg的現在應該知道怎么樣來Profile一個WCF項目了,今天我們來看一下怎樣Profile一個host到本地IIS上的WCF服務,我們還是使用Visual Studio 2010還有上篇blog中的測試項目。

  使用Administrator賬戶啟動Visual Studio 2010!

  How to: Host a WCF Service in IIS

  Deploying an Internet Information Services-Hosted WCF Service

  Using Visual Studio 2010 to Host a WCF Service on the Local IIS Instance

  Open or create a WCF Service Application project. Right click the project in the solution explorer and select Properties. In the project properties window select the Web tab on the left hand side of the window. On the right hand side of the window, under Servers, select the Use Local IIS Web Server and type in a URL. Next, click the Create Virtual Directory button and build the solution. This will create the virtual directory in IIS and map it to your project directory. The service will then be hosted on the local IIS server for building and debugging purposes. To verify the service has been hosted, open Internet Explorer and type the service’s URL in the address box. You must type in the complete URL path to the .svc file. For example, with a default WCF Service Application project hosted under http://localhost/MyFirstService the complete URL would be http://localhost/MyFirstService/Service1.svc. This will display the default WCF Service page.

hostWCF2LocalIIS

  使用同樣的步驟將我們的WebApplication1 asp.net應用程序項目也host到本地IIS上。

  WcfService1地址: http://localhost/WcfService1/Service1.svc

  WebApplication1地址: http://localhost/WebApplication1

proformancewizard1_4
proformancewizard2_4
proformancewizard3_4
proformancewizard4_4

  IE會直接打開WCF服務的頁面:

WcfService1

  現在我們可以用WebApplication1地址來替換WcfService1地址,并讓IE瀏覽它,這樣我們可以使用我們的asp.net應用來調用WcfService1中的函數,從而達到測試性能的目標。

testpage

  報表會在你關閉IE的時候,Visual Studio Profiler工具停止后,自動打開。

report1

  你可以看到所有的函數調用,但你點擊WcfService1.Service1.Abc(int32)函數后,它會為你打開一個詳細頁面和你的函數源代碼。

sourcecode

  My English Blog: http://mikedoszhang.blogspot.com/2011/11/profile-wcf-which-hosted-in-local-iis.html

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97