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.
使用同樣的步驟將我們的WebApplication1 asp.net應用程序項目也host到本地IIS上。
WcfService1地址: http://localhost/WcfService1/Service1.svc
WebApplication1地址: http://localhost/WebApplication1
IE會直接打開WCF服務的頁面:
現在我們可以用WebApplication1地址來替換WcfService1地址,并讓IE瀏覽它,這樣我們可以使用我們的asp.net應用來調用WcfService1中的函數,從而達到測試性能的目標。
報表會在你關閉IE的時候,Visual Studio Profiler工具停止后,自動打開。
你可以看到所有的函數調用,但你點擊WcfService1.Service1.Abc(int32)函數后,它會為你打開一個詳細頁面和你的函數源代碼。
My English Blog: http://mikedoszhang.blogspot.com/2011/11/profile-wcf-which-hosted-in-local-iis.html
原文轉自:http://www.anti-gravitydesign.com