Home Contact RSS

Archive for June, 2008

Makale 15: Remoting Uygulamalarında Hata Ayıklamak

Remoting server’ı çoÄŸu durumda üzerinde çalıştığınız bilgisayar üzerinde bulunmayacaktır. Bunun yerine daha güçlü ve stabil server’lar üzerinde çalışmaları tercih edilecektir. Bu da büyük bir ihtimalle server üzerinde Visual Studio’yu install edemeyeceÄŸiniz anlamına gelmektedir.

.NET uygulamalarının remote debugging yöntemi ile debug edilebilmesi için uygulamanın çalıştığı bilgisayar üzerinde Remote Debugging Components olarak adlandırılan add-on’ların kurulu olması gerekmektedir. Bu add-on’lar Visual Studio’nun kurulu olmadığı bilgisayarlar üzerinde de kurulabilir. Bunun için Visual Studio DVD’si içerisindeki \vs\Remote Debugger\x86 klasöründe bulunan exe dosyasının çalıştırılması gerekmektedir.

Remoting server’ının Console Application, Windows Application ve ya IIS üzerinde olması durumunda debugging iÅŸlemleri normalde yapıldığı ÅŸekilde ve ya process Visual Studio’ya attach edilerek yapılabilir. Windows service’leri ise bu noktada yalnızca attachment yapılarak debug iÅŸlemlerinin yapılabilmesine olanak vermektedir.

Farklı bir bilgisayar üzerinde çalışan Remoting server’ının debug edilebilmesi iÅŸin Windows service’inin çalıştığı bilgisayar üzerinde sırasıyla ÅŸu iÅŸlemler takip edilmelidir:

1.     Start > Microsoft Visual Studio 2005 > Visual Studio Tools menüsü içerisindeki “Visual Studio 2005 Remote Debugger Configuration Wizard” shortcut’ına tıklayın.

2.     Açılan ekranda Next butonuna tıklayın.

3.     Sonraki ekranda Remote debugger’ın servis olarak deÄŸil sadece çalıştırmanız durumunda çalışması için Run the “Visual Studio 2005 Remote Debugger” service seçeneÄŸini unchecked olarak bırakın.

4.     Next butonuna tıklayın.

5.     Allow only computers on the local network (subnet) to connect to the remote debugger seçeneğini işaretleyin.

6.     Next butonuna tıklayın.

7.     Configuration işlemi tamamlandı.

8.     Finish butonuna tıklayın.

9.     Start > Microsoft Visual Studio 2005 > Visual Studio Tools menüsü içerisindeki “Visual Studio 2005 Remote Debugger” shortcut’ına tıklayın.

10.  Visual Studio 2005 Remote Debugger çalışır.

Yukarıdaki iÅŸlemler tamamlandıktan sonra Remoting server’ının bulunduÄŸu bilgisayar uzaktan baÄŸlanacak yetkili bilgisayarların debugging iÅŸlemi yapmasına izin verecektir. Debug iÅŸlemi ise ÅŸu ÅŸekilde yapılır:

1.     Visual Studio’yu çalıştırın.

2.     Windows service’inin source code’larının bulunduÄŸu project’i açın.

3.     CTRL + ALT + P tuÅŸ kombinasyonunu ve ya Debug > Attach to Process… seçeneÄŸine tıklayarak “Attach to Process” ekranını açın.

4.     Qualifier seçeneÄŸini Remoting server’ın üzerinde çalıştığı bilgisayar olarak seçin.

5.     Refresh butonuna tıklayın.

6.     Available processes listesinde bulunan uygulamalar arasından Windows service’inizi seçin. ÖrneÄŸin geliÅŸtirmiÅŸ olduÄŸumuz MyFirstRemotingService uygulaması için process ismi MyFirstRemotingService.exe olur.

7.     Attach butonuna tıklayın.

8.     MyRemotableType.cs dosyası içerisinde debug etmek istediÄŸiniz satırlara Breakpoint’ler ekleyin.

9.     Yeni bir MyFirstRemotingClient.exe uygulaması çalıştırın.

10.  Visual Studio Breakpoint’inizin bulunduÄŸu satıra geldiÄŸinde debug ekranına geçiÅŸ yapar.

UYARI

Debug iÅŸlemini yapacak olan client’ın üzerinde logon olmuÅŸ user account’unun Remoting server’ının çalıştığı bilgisayar üzerinde bulunan “Debugger Users” user grubunun içerisinde tanımlanmış olması gerekmektedir. Aksi taktirde authorization ile ilgili sorunlarla karşılaÅŸabilirsiniz.

Görüldüğü üzere .NET kendi bilgisayarımız üzerinde bulunmayan .NET uygulamalarını debug edebilmek için gerekli olan tüm esnekliÄŸe sahip. Remoting server’ının kapatılmamasını gerektiren durumlarda bu olanak son derece faydalıdır.

Özet

  • Remoting server’ları IIS, Windows Application, Windows Service (NT Service) ve Console Application tipindeki uygulamalar kullanılarak host edilebilir.
  • IIS üzerinde host edilen Remoting server’ları yalnızca HTTP protokolünden faydalanabilir.
  • Remoting server’ları uzak bilgisayarlardan debug edilebilirler. Bu iÅŸleme Remote Debugging adı verilmektedir.
  • InstallUtil.exe Windows Service uygulamalarının kurulması için kullanılan bir utility’dir. -u parametresiyle birlikte kullanıldığında service uninstall iÅŸlemi için de kullanılabilir.
  • Remoting server’larının Windows Service üzerinde host edilmesinin en büyük avantajı yüksek hata management’ı ve otomatik startup olanağıdır. Service’in hata alması durumunda nasıl bir davranış sergileyeceÄŸi developer tarafından belirlenebilir.
  • Performance monitoring .NET uygulamalarının hangi iÅŸlemi ne kadar zamanda yaptığı, AppDomain ve ya tüm .NET uygulamaları içerisinde (seçilen instance deÄŸerlerine baÄŸlı olarak) kaç kere Exception throw edildiÄŸi gibi birçok runtime bilgisinin kolayca raporlanabilmesi için kullanılmaktadır.
  • System.Diagnostics.PerformanceCounter class’ı .NET uygulamaları içinde performance counter data’larına eriÅŸilebilmesine imkan tanımaktadır.

Using DataPager with Code-Behind Data Source

Some of you might have already realized that DataPager does its job only if you use a DataSource control. For instance, if you want to set a ListView’s DataSource property in page’s Load event and expect DataPager control to successfully page the ListView control, it means that you will need to spend your hours to find why it does not work.

Even though I still can’t figure out why it does not work, here is the workaround. Just create a DataSource control (e.g.: LinqDataSource) control just with “ID” and “runat” properties and then hook the “Selecting” event. Also set the ListView’s “DataSourceID” property to the ID of the DataSource control. What you will do there is to set the “Result” property of the SelectEventArgs argument.

<asp:LinqDataSource ID="LinqDataSource1" runat="server" OnSelecting="LinqDataSource1_Selecting">
</asp:LinqDataSource>  

 

protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
e.Result = GetDataSource(); // Assuming that GetDataSource method returns the datasource.
}  

Now you can save your hours.

SharePoint Developer Introduction for .NET Developers launched

The new material is designed to help .NET Developers to learn the top ten artifacts in SharePoint that are interesting to them. Microsoft has created a variety of materials with different learning styles to make getting started with these artifacts easy and it’s all based on the Visual Studio extensions for SharePoint – planned to release v1.2 for Visual Studio 2008 this week also (watch for their announce).

The Top Ten SharePoint Artifacts of interest to .NET Developers being promoted
• Web Parts
• Data Lists
• Event Handlers
• Workflows
• Silverlight Web Parts
• Page Navigation
• Page Branding
• Web Services
• Content Types
• User Management

At the site (which is hosted on microsoft.com) they have:
• An Introductory Whitepaper
• Benefits of SharePoint for Developers
• A Small Public VPC
• Hosted MSDN Virtual Labs in C# and VB.NET
• Video Interview with SharePoint MVPs
• Screencasts
• Web Casts with SharePoint MVPs (incredible 1705 live attendees in just the first four WebCasts)
• Quickstarts
• Labcasts
• Presentation Download
• Hands on Labs Download
• Additional Resource Links

The site encourages developers who use the content to also take a next step and go on Instructor Led Training, Get Certified, and Download an evaluation copy of Microsoft Office SharePoint Server.

http://MSSharePointDeveloper.com