X Blogs

who you gonna call?

Crawl BCS Data

clock June 29, 2011 21:26 by author Robi


One of our clients wants to crawl data that they store in SQL Database so I created a new External Content Type to test the solution and gave it a name of TestSql.

To crawl BCS content source, you need to give a default content access account or account you want to crawl you content source Execute permissions on External Content Type. Click on the Drop down and select Set Permissions. Add your search account and select Execute Permissions.


Next, you need to define new content source in Search Service Application administration. In order to do that, click on Content Sources category and then New Content Source.

Give your Content source a meaningful name, select Line of Business Data and select BCS Service Application where you External Content type is saved. Create Crawl Schedules and perform a full crawl of your Content Source.


When full crawl is finished you can search for your line of Business data. Go to your portal site and search for your data. Notice that link to that data is somewhat strange.


To correct this "issue" you need to create Profile Pages for BCS Data. Go back to your BCS Service application and on the Ribbon, in the Profile Pages section click Configure. You need to specify SharePoint site to host Profile pages.


When Profile page host is created, you can now Create/Upgrade Profile page. Select External Content Type and click Create/Upgrade button.

When operation is finished, perform a full crawl of this Content Source and you should now get results similar to this:


When you click on the link you get BCS Data directly from your SQL Server:


Hope it helps!


SharePoint jokes

clock June 16, 2011 23:08 by author Robi

Enjoy laughing at SharePoint people:


NTK 2011 - New in Microsoft Virtualization

clock May 27, 2011 01:03 by author joze

Novosti v Microsoftovi Virtualizaciji

Virtualizacija postaja del večine poslovnih okolij. Nekje samo na klientih, pri večini pa tudi že na strežnikih.
Tekom predavanja si bomo pogledali, kaj je Microsoft v zadnjem letu postavil na trg, kaj je spremenil in kaj posodobil. Pogledali si bomo tako Windows Virtual PC, kot tudi HyperV strežnik. Zraven pa še kak trik za upravljanje enega in drugega.


Last week I was presenting at Slovenian Microsoft’s conference – NTK or. NT konferenca.

Attached to this post you can find my presentation. You can also find it on the original NTK page.

Novosti v Microsoftovi Virtualizaciji

Azure AppFabric Cache HowTo

clock May 3, 2011 04:24 by author Rok Bermež
Well since we now have Azure AppFabric Cache available, let’s get a head start on how to use it in your Cloud ASP.NET (MVC) application. First, you need to have AppFabric 1.0 April Refresh SDK installed on your machine so grab it at here.
Next, go to Windows Azure Management portal. Log in, go to AppFabric/Cache and create new service namespace: wait for the service to be activated.

Then click 'View Client Configuration Button'

you will get a nice pre prepared configuration settings (with all those pesky security information included) for your app:
now we have all the pieces of the puzzle ready, all we have to do is to add references to caching dlls (located at C:\Program Files\Windows Azure AppFabric SDK\V1.0\Assemblies\NET4.0\Cache) to our application and change web.config with the settings given by previous step.

You would always need to put cache section in <configSections> node:
<section name="dataCacheClients" 
allowLocation="true" allowDefinition="Everywhere"/>
and configure your Cache EndPoints:
    <dataCacheClient name="default">
        <host name="ntkonferenca.cache.windows.net" cachePort="22233" />
      <securityProperties mode="Message">
    <dataCacheClient name="SslEndpoint">
        <host name="ntkonferenca.cache.windows.net" cachePort="22243" />
      <securityProperties mode="Message" sslEnabled="true">
If your application uses Session State and you want it to use Azure AppFabric Cache (which you do) you change your <sessionState> node to:
    <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
        <add name="AppFabricCacheSessionStoreProvider"
cacheName="default" useBlobMode="true" dataCacheClientName="default" /> </providers> </sessionState>
and the same for OutputCache by changing <caching> note:
    <outputCacheSettings enableFragmentCache="true" defaultProvider="DistributedCache">
        <add name="default" duration="43000" />
        <add name="DistributedCache"
cacheName="default" dataCacheClientName="default" /> </outputCacheProfiles> </outputCacheSettings> </caching>
That’s it, nothing needs to be changed in your code, your app is configured and ready to be published to the cloud. AppFabric Cache is not a free service even if you won’t be charged anything for its use prior to August 1, 2011. After that the prices are:
  • 128 MB cache for $45.00/month
  • 256 MB cache for $55.00/month
  • 512 MB cache for $75.00/month
  • 1 GB cache for $110.00/month
  • 2 GB cache for $180.00/month
  • 4 GB cache for $325.00/month
In my next post, Ill tackle with using AppFabric Cache without using prepared providers by simple GET and PUT statements (lets get rid of HttpRuntime.Cache as well).


Windows Azure AppFabric Caching Service Released

clock April 30, 2011 19:52 by author Rok Bermež

Finally the Azure thingy I’ve been waiting for the most. From the official source:

Today we are excited to announce that the Caching service has been released as a production service.  

The Caching service is a distributed, in-memory, application cache service that accelerates the performance of Windows Azure and SQL Azure applications by allowing you to keep data in-memory and saving you the need to retrieve that data from storage or database.

We provide 6 different cache size options for you to choose from, varying from 128MB to 4GB.  In order for customers to be able to start using the service and evaluate your needs we are running a promotion period in which we will not be charging for the service for billing periods prior to August 1, 2011.

To learn more about the Caching service please use the following resources:

·        Windows Azure AppFabric Caching availability announced!! blog post, including more information on pricing.

·        Video: Introduction to the Windows Azure AppFabric Cache

·        Video: Windows Azure AppFabric Caching – How to Set-up and Deploy a Simple Cache

·        Windows Azure AppFabric FAQ on MSDN

·        MSDN Documentation

The service is already available in our production environment at: http://appfabric.azure.com.

For questions on the Caching service please visit the Windows Azure Storage Forum.

Customers can take advantage of our free trial offer to get started with the Caching service and Windows Azure AppFabric. Just click on the image below and get started today!


Manualy Submiting Unobtrusive MVC 3 Ajax Form

clock April 21, 2011 23:21 by author Rok Bermež
If you want to submit Ajax.BeginForm created ajax form a simple this.form.submit() wont work. Well to be exact it will, but not as it was intended. In order to make it work like expected, we can do it like this:
Html.DropDownList("selPredavanja",ViewBag.Lectures as SelectList,new { onchange = "Sys.Mvc.AsyncForm.handleSubmit( this.form, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'lectureData' });"})

Remote Server Administration Tools for Windows 7 SP1 available for download

clock April 12, 2011 21:38 by author joze

RSAT Client is the collection of Windows Server management tools which enable IT professionals to manage their Windows Server infrastructure from their PCs running Windows 7 SP1 and Windows 7.

This is the list of Windows Server administration tools which are included in RSAT Client for Win7 SP1:

Server Administration Tools:
Server Manager

Role Administration Tools:
Active Directory Certificate Services (AD CS) Tools
Active Directory Domain Services (AD DS) Tools
Active Directory Lightweight Directory Services (AD LDS) Tools
DHCP Server Tools
DNS Server Tools
File Services Tools
Hyper-V Tools
Terminal Services Tools

Feature Administration Tools:
BitLocker Password Recovery Viewer
Failover Clustering Tools
Group Policy Management Tools
Network Load Balancing Tools
SMTP Server Tools
Storage Explorer Tools
Storage Manager for SANs Tools
Windows System Resource Manager Tools

Download page at Microsoft Download Center: RSAT for Windows 7 with SP1

If you followed my previous post on how to manually install RSAT tools on Windows 7 with SP1 you can also install this update on your PC over existing RSAT tools.

Windows Azure Cache Dependency

clock April 11, 2011 08:07 by author Rok Bermež

We are supposed to get Windows AppFabric Cache real soon, but till than form time to time we need to synchronize content cached inside our Web roles. SqlDependency is one way, but it cannot solve all problems (especialy those that are not based on SQL data). So to help with the matter I wrote AzureStorageCacheDependency that uses Azure storage to know when data is outdated and cache shloul be cleared. If anyone is in need of something similar, here it goes:

public class AzureStorageCacheDependency : System.Web.Caching.CacheDependency
        private System.Threading.Timer _timer;
        private int _poolTime;
        private CloudBlob _blob;
        private string _key;

        public AzureStorageCacheDependency(string connectionString, string conteinerAddress, string blobAddress, int poolTime = 5000)
            _poolTime = poolTime;
            using (AzureContext azureContext = new AzureContext(true))
                var storageAccount = CloudStorageAccount.Parse(connectionString);
                CloudBlobClient blobStorage = storageAccount.CreateCloudBlobClient();
                CloudBlobContainer container = blobStorage.GetContainerReference(conteinerAddress.ToLower());
                _blob = container.GetBlockBlobReference(blobAddress.ToLower());
                if (!Exists(_blob))
                    _key = _blob.DownloadText();
            _timer = new Timer(new System.Threading.TimerCallback(CheckDependencyCallback), this, 0, _poolTime);

        public void Reset()
            _key = Guid.NewGuid().ToString();

        private void CheckDependencyCallback(object sender)
                if (!Exists(_blob) || _key != _blob.DownloadText())
                    NotifyDependencyChanged(this, EventArgs.Empty);

        public static bool Exists(CloudBlob blob)
                return true;
            catch (StorageClientException e)
                if (e.ErrorCode == StorageErrorCode.ResourceNotFound)
                    return false;

    public class AzureContext : IDisposable
        HttpContext _oldHttpContext;
        bool _restoreOldHttpContext = false;

        public AzureContext(bool forceSettingContextToNull = false)
            if (forceSettingContextToNull)
                _oldHttpContext = HttpContext.Current;
                HttpContext.Current = null;
                _restoreOldHttpContext = true;
                    HttpResponse response = HttpContext.Current.Response;
                catch (HttpException)
                    _oldHttpContext = HttpContext.Current;
                    HttpContext.Current = null;
                    _restoreOldHttpContext = true;

        public void Dispose(bool disposing)
            if (disposing)
                if (_restoreOldHttpContext)
                    HttpContext.Current = _oldHttpContext;

        public void Dispose()


SBSC – 2011.04 – Freeware tools for administration

clock April 6, 2011 07:24 by author joze

Today I was presenting at SBSC. Attached to this post is my presentation. In it you can hopefully find some useful resources that will help you do the things you do a little faster.

Also worth checking:
- Mon.itor.us



clock April 5, 2011 23:31 by author Rok Bermež
From time to time, we need to selectively redirect the browser to another location as a 
result of an AJAX action. Just returning RedirectResult won’t do the trick (even if we
are used to similar functionality in ASP.NET AJAX in combination with WebForms ). Here
is a very simple RedirectResult thet will be appropriate in those scenarios:

public class AjaxRedirectResult : RedirectResult { public AjaxRedirectResult(string url): base(url){} public override void ExecuteResult(ControllerContext context) { if (context.RequestContext.HttpContext.Request.IsAjaxRequest()) { JavaScriptResult result = new JavaScriptResult() { Script = String.Format("window.location='{0}';",
UrlHelper.GenerateContentUrl(Url, context.HttpContext)) }; result.ExecuteResult(context); } else base.ExecuteResult(context); } }

About the author

Rok Bermež is Slovenian Windows Azure MVP, he works as a Software Engineer and Microsoft Certified Trainer at Kompas Xnet. His primary interests include cloud computing and web development. With extensive experience in development and architecture he participated in many projects and since the CTP release of Windows Azure much of those projects are based on Windows Azure platform. Rok has been delivering courses, writing code and speaking at conferences and community events on Microsoft technologies for the last couple of years. You can also find him on Twitter (@Rok_B).

Month List

Sign In