Ask your technical questions on forums or here :
ASP.NET or MVC | C# | Windows Phone
Microsoft Technology Journals by Abhimanyu K Vatsa
HOME ABOUT RAZOR BOOK SPEAKING MVC ASP.NET JQUERY VIDEOS EBOOK ARCHIVE
Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

8 Apr 2015

How to run Node.js on IIS

In this post you will learn how to run Node.js applications on IIS Server. As you know, Node.js is an open source, cross-platform runtime environment for server-side and networking applications. This is mostly written in JavaScript, and can be run within the Node.js runtime itself installed on Windows, Linux etc. Node.js was originally invented in 2009 by Ryan Dahl, and other developers working at Joyent.

19 Jun 2014

Internal Server Error with httpHandlers section of web.config

Today I encountered titled error when I was deploying IIS6 hosted application on IIS8. On browsing the application all it displayed me is 404 page and I was not able to run the debugger to check the application code.

29 May 2013

Windows Authentication in MVC4 with IIS Express

MVC4 gone through some major changes in Windows Authentication functionality with IIS Express. In this article you will learn how to enable Windows Authentication in MVC4 Web Application on IIS Express, just follow the given steps.

11 Dec 2012

The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)

Today I added a new user in my existing database for some web application experiments and when I tried to delete the user I received following error message.

8 Jun 2012

How to open IIS Manager in Windows 8

To open “IIS Manager” on Windows 7 or earlier OS, we were typed “inetmgr” in run window. But for a while I got confused that how I open “IIS Manager” in my Windows 8 PC? Here is the step.



25 May 2012

Testing Website using SSL on Localhost (IIS)


Introduction
SSL (Secure Socket Layer) is a cryptographic protocol developed by Netscape to provide communications security on internet. Cryptographic technology uses two keys to encrypt data, one for public (public key) and another for recipient (secret key). SSL enabled website communicates with web server by using security channel (secret key) that prevents tempering, eavesdropping (or simply say hacking). Mostly probably SSL is used on login section, payment system, online banking system etc that is very sensitive information for organization. When we enable the SSL for website URL will start with https:// instead of http://.
Requirements
To test this, you should have IIS installed. No need of extra software like Visual Studio or any other website development kit because only a single HTML file can be tested.
Follow the steps to enable SSL on Windows Server 2008 R2 Operating System; another Operating System may have little difference.
Step 1
Open IIS Manger and select root computer name > and double click on ‘Server Certifications’. Look at image given below.
Step 2
Now in appeared window you will find ‘Server Certificates’ that already installed. No problem if there is another one already exists, I recommend to delete all by selecting each and create a new one. If you are not using your system for professional website hosting then, delete all.
Look at right panel, you will find ‘Create Self-Signed Certificate’ click on it. You will be prompted to enter the friendly name for SSL and click on OK button. I’m using ‘itorian’ here. Look at image given below.
Step 3
After clicking on OK button you will find a new SSL entry. Now navigate to ‘Site List’ and right click on that to choose ‘Edit Binding’ option. Look at image given below.
Step 4
When you click on ‘Edit Binding’, you will get a new window asking for protocol type. There may be three four items, in my example there is only one by default that is ‘http’. No problem if you have many more. At least one should be there. Now click on ‘Add’ button and in the appeared window select the ‘Type’ to ‘https’ and ‘SSL Certificate’ to ‘itorian’. When you done, I recommend to delete all another protocol types, only keep https. Close the small window listing protocols at the end.
Step 5
Now everything is configures and enabled for you. Let’s test it.
Please note I only have single protocol that is ‘https’ so by default any browser reacts on http you have to use here https while requesting via browser.

That’s all about the SSL configuration on localhost.

23 May 2012

Failed to generate a user instance of SQL Server due to failure in retrieving the users local application data path


In this post you are going to learn how to fix titled error.

Possible Solution

Step 1
Open IIS Manager and click on "Advance Settings" to open a new window.
Step 2
When you click on "Advanced Settings", it will pop a screen.
In this window, set the "Load User Profile" to True and restart the IIS.

Becoming a Web Pro Black Belt - Mastering IIS and Other Essential Web Technologies by Scott Forsyth


There is a shortage of end to end practical training for the web pro available today. This 52-week series targeted at the current or up-and-coming web pro is meant to address this need.


Scott Forsyth releases a video each week on a different aspect of this arena. Scott has a unique background that makes this such a valuable series. He has over a decade of specific hands on expertise in hosting both highly available and highly scalable web farms, and working through the intrinsic details of shared hosting. Over the years Scott worked has worked tirelessly day and night, often burning the midnight oil while troubleshooting difficult situations, or architecting the best end-to-end configuration for upcoming projects. His passion comes through in each video, while his years of real world expertise bring experience that will strengthen newbies and professionals alike.


Find Videos Here

Adding Website in IIS and Using Friendly Name to Open the Website

In this video you are going to learn how to add website in IIS and even how to use friendly name to open that website.

Creating New Website and configuring local IIS using Visual Studio

Introduction


Before writing anything, I will say this is a very simple article for those who don't know how to create website in IIS and navigate that website without opening Visual Studio IDE always. Means just open the browser and navigate that local websites. Actually such system has very huge advantages if we are working on intranets (in simple, local internet called intranet). Means if we have dozen of computers under network and one of the PC has server configuration then such websites can be available on each PC on network. Many companies has adopted such service, BSL is one the example who is using such services since decade.

Look at below, I have opened a ASP.NET website without Visual Studio IDE.

 

In the above browser snap, 'localhost' url part may be replaced by computer name or IP. Look at snap below.
 
Okay, introduction is over now. Let's configure such system for our website developments. Follow the steps for the same.
Note: Please be sure of IIS installation.

Step 1


Open the Visual Studio IDE as administrator. For this you need to go through the snap given below.

 

Step 2

Now, if IDE is opened then navigate to File > New > Web Site… and then look at snap below. I just have chooses HTTP as my website root location and then website name as 'TestSite'. At the end click on ok button.


Step 3


Now you have an IIS (localhost) website that will be accessible from browser directly. Let's test this. Open the browser and type


OR


OR


Let's look at my own screen.


I hope you will love this.

22 May 2012

Website Error Reporter (Smart way to handle website errors) in ASP.NET


Introduction

In this article and video post, you will learn how to develop such web application in ASP.NET which can report to the Admin guy about the errors that end users (website users) is experiencing on your blog/website. After reading this post you are definitely going to add this feature to your existing website or blog.


I know I'm bit fogy in programming, but I write whatever I experience or learn. Within last 2-3 days I experienced errors on very-very popular websites namely Google, Yahoo and even few technical community websites. I can't doubt on Google or Yahoo because they have very highly qualified system to deal with.





But I can doubt on websites which redirect me on the page having following message:


Displayed error page "Server Error in '/' Application.", means they are not dealing properly with errors. When I reported to the admin guys, they again asked me back to provide the source URL and target URL, where I saw this error. Even in past I was asking the same from my blog (www.itorian.com) users to provide the broken links or some other bugs. So, it is normal thing in web apps.

Developing bug free website is desired by every Web Technologist. We can't fix our 100% bugs from our applications especially from web platform, because on web platform we not only program code-behind, databases and views even managing each and every URL's on website is also big task.

Well, I experience this so, I'm going to write the same post which describes how to deal.


Now, follow the steps (described in video) to create such Web application.

Step1

Create Web Application by navigating File > New > Project > ASP.NET Web Application.

Step2

Open the Global.asax file and type following coding in Application_Error.

void Application_Error(object sender, EventArgs e)
{
    // Code that runs when an unhandled error occurs
    Response.Write("<h2>Error Page</h2>");
       
    // Get the exception details
    Exception exc = Server.GetLastError();
    Response.Write("Sorry for the inconvenience that may have been caused to you.");
    Response.Write("<b>Error Message</b><p>" + exc.Message + "</p><br>");
       
    // Clear the error from the server
    Server.ClearError();

    // Report to Administrator
    string url = HttpContext.Current.Request.Url.AbsoluteUri;
    string MailBody = "Website user is getting bad experience on you website. Find the details below:<br><br>";
    MailBody = MailBody + "<br><br><b>Error on Page (Target Webpage): </b>" + url;
    MailBody = MailBody + "<br><br><b>Link on Webpage (Source Webpage): </b>" + Request.UrlReferrer;
    MailBody = MailBody + "<br><br><b>Error Message: </b>" + exc.Message;
    MailBody = MailBody + "<br><br><b>Trace Message: </b>" + exc.StackTrace;
       
    // Other browser based stuffs
    MailBody = MailBody + "<br><br><b>Platform: </b>" + Request.Browser.Platform;
    MailBody = MailBody + "<br><br><b>Browser: </b>" + Request.Browser.Browser;
    MailBody = MailBody + "<br><br><b>Browser Type: </b>" + Request.Browser.Type;
    MailBody = MailBody + "<br><br><b>Browser Version: </b>" + Request.Browser.Version;
       
    string MailResponse = sendmail("abhikumarvatsa@yahoo.co.in", "Bad Experience", MailBody);
    Response.Write("<br><br><b>Note: </b>" + MailResponse.ToString());
}

Step3

Create a new method in Global.asax file for sendmail method as given in above code. Here is the method code:

private string sendmail(string ToEmailAdd, string MailSubject, string MailMessageHTMLString)
{
    System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();

    message.To.Add(new System.Net.Mail.MailAddress(ToEmailAdd));
    message.From = new System.Net.Mail.MailAddress("abhimanyukumarvatsa@itorian.com", "ITORIAN.COM");
    message.Subject = MailSubject;
    message.Body = MailMessageHTMLString;
    message.IsBodyHtml = true;

    System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();

    client.Port = 25;
    client.Host = "mail.itorian.com";
    System.Net.NetworkCredential nc = new System.Net.NetworkCredential("abhimanyukumarvatsa@itorian.com", "*****");
    client.UseDefaultCredentials = false;
    client.Credentials = nc;

    try
    {
        client.Send(message);
        return "Automated System success to report this to the Administrator.";
    }
    catch
    {
        return "Automated System not success to report this to the Administrator.";
    }
}

Step4

Now open the Site.Master and create any broken link or any other runtime mistake and then run the project.

Step5

Type to navigate by clicking broken link, it will display the error message instead of displaying the red page error and also sends the email to you inbox containing full error description in body.
Video Post


Failed to update database \APP_DATA\ASPNETDB.MDF because the database is read-only


Failed to update database "C:\INETPUB\WWWROOT\COMPUZIT\APP_DATA\ASPNETDB.MDF" because the database is read-only.

Today when I configured IIS on Windows 7 machine, my all websites displayed titled error, when I googled the fix then I got following that fixed my error.

1.) Make sure your virtual directory is running ASP.NET.
2.) Give the user ASPNET full control over the App_Data directory found within your website.
3.) Restart IIS to refresh its permissions.

I hope this post will help you to fix your machine error.

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel


Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Today when I configured IIS on Windows 7 machine, my all websites displayed titled error, when I googled the fix then I got following that fixed my error.

This can typically happen when you installed 4.0 first and then enabled 3.0 HTTP Activation later.
Navigate to following path:-

C:\Windows\System32\inetsrv\config

This issue is usually caused because the app's host config (applicationHost.config) has the following incorrectly defined section:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />

This should be:

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />

I hope this post will help you to fix your machine error.

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed


Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

Today one of my friends asked me to fix this issue for him. And I was also new to that issue but after lot goggling I got the solution and I am going to share this with you.

Follow the steps:-

Step 1

Open the "Internet Information Services (IIS) Manager".

Step 2

Expand the connection explorer to select "Application Pools".

Step 3

In the "Application Pools" list select the "DefaultAppPool" and click on open its Advanced Settings. Look at image given below:


Step 4

Now in opened window, set the "Load User Profile" to true. Look at image given below.


Now test your application, it will work for you. I hope you like it. Please send your feedback.