This Blog

Syndication

News

Awards

Microsoft MVP Logo
Grab this badge here!

Certificates

Transcript ID#: 6724122
Brainbench ASP.NET Certificate
 
Brainbench ASP.NET 2.0 Certificate
 
Brainbench .NET Framework 2.0 Certificate

Ahmad Masykur

var myObject = { "languages" : [ "C#", "VB.NET", "ASP.NET", "Javascript", "SDCC", "Assembler" ] }; //

January 2009 - Posts

  • Membuat WCF Service yang di-Host pada Website dengan Multiple Identities

    Ketika WCF service di-host di IIS website yang mana terdapat multiple identities yang dapat merespon dari URL dan port yang berlainan, WCF service tersebut ketika dipanggil akan menghasilkan error sebagai berikut:

    This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
    Parameter name: item

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
    Parameter name: item

    Saya tahu bahwa ini adalah behavior yang memang didesain oleh Microsoft dan ada solusi untuk masalah ini. Akan tetapi setelah googling di beberapa forum, MSDN dan beberapa blog, saya tidak mendapatkan solusi yang tepat. Saya hanya mendapatkan solusi untuk mengambil URL pertama dari daftar alamat alias yang ada. Ini bukan solusi yang tepat bagi saya karena semua WCF service harus dapat diakses dari semua alamat alias. Terima kasih kepada Zeddy yang telah membatu dalam memecahkan masalah ini. Masalah ini dapat diatasi dengan membuat custom ServiceHostFactory yang menghapus semua baseAddresses lalu override Behaviors dan ServiceEndPoint sebagaimana saya uraikan dalam langkah-langkah di bawah. Saya gunakan contoh WCF service dengan name MyService yang diimplementasikan dari IMyService.

    Buat Custom ServiceHostFactory

    Buat class baru untuk custom ServiceHostFactory berikut.

    using System; using System.ServiceModel; using System.ServiceModel.Activation; using System.Linq; using System.ServiceModel.Description; public class MultipleIISBindingSupportServiceHostFactory : ServiceHostFactory { protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { var host = base.CreateServiceHost(serviceType, new Uri[] {/*empty*/ }); // Setup MEX dynamically var behavior = new ServiceMetadataBehavior { HttpGetEnabled = true, HttpGetUrl = baseAddresses.Where(addr => addr.Scheme == "http").First() }; host.Description.Behaviors.Add(behavior); // Setup Endpoint dynamically foreach (var uri in baseAddresses) { // Service endpoint support http scheme only, exclude https scheme if (uri.Scheme == "http") { host.AddServiceEndpoint(typeof (IMyService), new BasicHttpBinding(BasicHttpSecurityMode.None), uri ); } } return host; } }

     

    Ubah Markup WCF Service

    Untuk mengubah markup WCF Service, klik kanan pada file MyService.svc lalu klik "View Markup".

    <%@ ServiceHost Language="C#" Debug="true" Service="MyService" CodeBehind="MyService.svc.cs" Factory="MultipleIISBindingSupportServiceHostFactory" %>

    Ubah Web.config File

    Buka file web.config, pada element <system.serviceModel>, ganti element <system.serviceModel> dan semua child elements dengan configurasi berikut.

    <system.serviceModel> <diagnostics> <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true"/> </diagnostics> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel>

    Setelah semua langkah dilakukan, seharusnya masalah multiple identities dapat teratasi.

    Semoga tips in bermanfaat. Versi Bahasa Inggris tulisan ini dapat dilihat di sini.

    Share this post: | | | |
  • Windows 7 x64 | A First Look

    Kesan pertama setelah menginstall Windows 7 x64 terasa tidak jauh beda dengan pendahulunya. Gaya dan tampilan masih mirip Windows Vista. Setelah dijelajah beberapa fungsinya juga tidak begitu banyak tambahan. Tapilan Windows 7 pada laptop saya bisa dilihat pada gambar berikut.

    Berikut saya sarikan beberapa kelebihan dan kekurangan yang saya dapati selama menggunakan Windows 7.

    Kelebihan:

    • Dari sisi performance terasa Windows 7 x64 lebih cepat.
    • Konsumsi harddisk pada fresh installation lebih hemat.
    • Konsumsi memori lebih hemat.
    • Pengaturan task bar lebih baik.
    • Hampir semua driver Windows Vista dapat digunakan di Windows 7.
    • Help and support tools lebih baik.
    • Window snapping sangat membantu menata window di layar side-by-side.

    Kekurangan/kegagalan:

    • Masih ada beberapa driver yang gagal diinstall.
    • Modem Sierra AirCard 875U tidak dapat digunakan.

    Belum mendapatkan banyak kekurangan di produk terbaru Microsoft ini. Yang sangat disayangkan saya tidak bisa online dan upgrade langsung dari Windows 7 karena modem tidak dikenali.

    Share this post: | | | |
    Posted Jan 14 2009, 10:37 PM by cahnom with 4 comment(s)
    Filed under:
  • Prayer Time Widget for BlogEngine.NET 1.4.x

    Prayer Time is time schedule for moslem prayer. This widget shows the daily prayer time based on user location. Thispicture below shows prayer time at January 11, 2009 in Jakarta. If you are from outside of Jakarta, the prayer time will automatically calculate base on your location.

    image

    I’m using prayer time algorithm from here and previous post here. This widget use Shafii and Muslim World League calculation except Indonesia and Malay use custom calculation.

    Complete source code can be downloaded from here. The installation is very easy, follow installation steps below:

    1. Extract the zip file to widget folder of your BlogEngine.NET site
    2. Login as Administrator
    3. Goto buttom of page
    4. Select “Prayer Time” from available widgets in combo box as picture below.
    5. Click Add.
    6. You can also move the widget to another location by refreshing the browser and drag n drop “Prayer Time” widget to desired location.

    image

     

    I hope this widget be useful for moslem blogger.

    Share this post: | | | |
  • Upgrade to BlogEngine.NET 1.4.5

    Alhamdulillah, my weblog already upgraded from BlogEngine 1.2 to BlogEngine.NET 1.4.5. Upgrading process is easy but should be carefully because there are incompatible settings and themes between BlogEngine 1.2 and BlogEngine 1.4.5. To upgrade BlogEngine from version 1.3 or 1.2 to version 1.4.x, you must prepare following items before upgrading:

    1. Upgrade theme if you are using custom theme (not included in theme package).
    2. Backup your xml data or database
    3. Backup your settings
    4. Create custom widget (if needed).

    I’m alredy updated my theme (Cogitation) for BlogEngine 1.4.x and create new widget (Image List) for displays image in the side bar. You can download Cogitation theme and Image List widget from following links.

    After upgrading BlogEngine, theme and installing widget, you might be need to reconfigure widgets. Rearange and add widget that you want to display in side bar.

    I hope my theme and widget are useful for you.

    Share this post: | | | |