Wednesday, March 14, 2012
.NET and ASP.NET interview question -Elaborate differentiation between Cache and Application?
Application and Cache both help to share global data and cache data across the users.but cache object is proactive and you can define dependency.In application object you can't define depenency.
Below is the code for declaring application and cache object.
CacheDependency objCacheDependency = new CacheDependency(Server.MapPath
("Banner.txt"));
Cache.Insert("Banner", strBanner, objCacheDependency);
Application["Banner"] = "strBanner";
In the above code, for Cache object you can define dependency but in Application object you can't define dependency.when the banner file is changed the Cache object can be refreshed but the application remain static and holds the old text of banner file.
WCF Interview Question - Method to perform Self-Hosting in WCF?
The following steps are followed to do Self-hosting.
Step1: //Create a URI to serve as the base address
// Address as well binding
Uri httpUrl = new Uri("http://localhost:8010/MyService/HelloWorld");
Step2: //Create ServiceHost
ServiceHost host = new ServiceHost(typeof(ClassLibrary1.HelloWorldService),httpUrl);
Step3: //Add a service endpoint
host.AddServiceEndpoint(typeof(ClassLibrary1.IHelloWorldService) , new WSHttpBinding(), "");
Step4: //Enable metadata exchange
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
Step5: //Start the Service
host.Open();
Step6:
Console.WriteLine("Service is host at " + DateTime.Now.ToString());
Console.WriteLine("Host is running... Press key to stop");
Console.ReadLine();
Subscribe to:
Posts (Atom)
Could not find a part of the path ... bin\roslyn\csc.exe
I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added a...
-
Adding the New HTML Editor Extender to a Web Forms Application using NuGet : The July 2011 release of the Ajax Control Toolkit includes a ne...
-
Building your first Windows Metro style app using C#, C++, or Visual Basic [This documentation is preliminary and is subject to change.] ...
-
September 2011 Release of the Ajax Control Toolkit : I’m happy to announce the release of the September 2011 Ajax Control Toolkit. This rele...