Tag Archives: best asp.net hosting tutorial

ByAlexia Pamelov

Cheap Windows IIS Hosting Tutorial – Everything you should know about IIS Express

CheapWindowsHosting.com | IIS Express provides us a set of flexibility to simulate an IIS hosted environment and test the application directly from the Visual Studio.  In the previous post you have seen  how we can enable SSL in IIS Express  by just a single enabling property. In this post I am going talk about few more important things that you should as a developer. This will help you in dealing with IIS Express.

Where does the basic configuration information stored ?

The basic information related to the IIS Express are stored inside the project file (proj file)  within the property group information section.  To view it, Open the Project File in edit mode ( In this case I will strongly recomand you to use Visual Studio productivity Tool ) ; where you can edit the project file using “Power Command” as shown in the image below.

iis1

Once you have the  project file in edited mode, you can search for below configuration section, where you can see the application information related to IIS Express are set.

iiss2

You can change the configuration editable values and update the project files to take the changes effects.

If your application has the SSL Enabled, IISExpressSSLPort will have the values specified for the SSL  port number.

...<IISExpressSSLPort>44302</IISExpress.SSL.Port>

Where is the configuration settings related to bindings and virtual directory?

Project files have the information related to the IIS Express and it’s basic settings; whereas there are several configuration files that are required to host and run a web application.  You can find all the IIS Express related files under \users\<username>\My Documents \ IISExpress\Config .

Open the “applicationhost.config” file in any text editor, and search for your web application name

As you can see this section contains the information related with the physical path of  IIS Express Virtual Directory, application pool  and the several bindings information.

The aplicationhost.config files are user specific.

Applying Multiple Bindings With IIS Express

You can add additional bindings within the “bindings” elements to access your sites using different urls.

&lt;bindings&gt;
&lt;binding protocol="http" bindingInformation="*:53294:localhost" /&gt;
&lt;binding protocol="http" bindingInformation="*:53295:my-pc" /&gt;
&lt;binding protocol="https" bindingInformation="*:44302:localhost" /&gt;
&lt;/bindings&gt;

There is an additional application – IISExpressTray

When you press F5 to run the project, Visual Studio automatically launches the IIS Express and it will show up in your task-bar tray while it’s running.

You can right-click and  select the “Application”  to get the list of currently active URL’s for the current application.  To navigate, you have to click on the site URL.

Along with the hosting sites, IIS Express ( IISExpress.exe)  is the parent process of an another application “IISExpressTray.Exe”. You can launch this application by just right click on IIS Express Icon on system tray icon and then select “Show All Applications” .

Following snaps shows the overall process hierarchy of IIS Express with in Visual Studio.

Quick way to get the details of the site configurations

From the application url lists, you can select any of the url / sites ; IISExpress tray application will show you different additional details such as runtime, application path and configuration.

This is the easiest option to open the application configuration file for IIS Express.

That’s all ! Hope going forward this information will help you to work with IIS Express.

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting Tutorial – 10 Standards on Choosing an ASP.NET Web Host

CheapWindowsHosting.com | In this article can save you a lot of time if you are troubled by looking for a suitable ASP.NET web host now. Based on a series of ASP.NET reviews and self-experiences of our editors, we have concluded top 10 important standards on how to choose an ASP.NET web host to help you make an easy decision.

10fcf5_68f3111291564bb19bb3833f5a885da3

ASP.NET is a kind of application framework, which is developed by Microsoft to build dynamic web pages, web applications and web services. It is set up on the Common Language Runtime so that users can write ASP.NET with any supported .NET language. Choosing a web host can be a very important access if you want to run ASP.NET successfully. The following items are the top 10 standards on how to choose a trusted web host for ASP.NET we have summed up.

Top 10 Standards on Choosing an ASP.NET Web Host

10 Standars on choosing ASP.NET

NO.1 Windows Server Edition

Windows server edition should be considered if you want to get along well with your ASP.NET hosting. It is the operating system of your Windows. In general, the newest edition is the first choice. Because newer Windows server edition can offer more features than the old one. Now usually the edition of 2010 and 2008 R2 are preferred.

NO.2 MSSQL Server

MSSQL is a database system invented by Microsoft Inc. It is used to store and retrieve data as required by other applications. Usually there are 5 versions widely used in web hosting industry including MSSQL 2000, 2005, 2008, 2008 R2 and 2012. So far, the best suitable version for ASP.NET hosting is MSSQL 2012.

NO.3 .NET Framework Version

The .NET Framework is a kind of software framework which has a large library offering language interoperability among several various programming language. Therefore, the supported .NET Framework version is an important factor on choosing an ASP.NET web host. The widely used versions are 2.0, 3.5 SP1 and 4.5 , 5,

NO.4 ASP.NET MVC Version

MVC implies model-view-controller. ASP.NET MVC is a web application framework which carries on model-view-controller pattern. ASP.NET MVC allows software developers to build a web application as a composition of three roles: Model, View and Controller, thereby allowing each component to be easily tested independently. The three widely used ASP.NET MVC versions are 2.0, 3.0, and 4.0.

NO.5 ASP.NET Hosting Trust Level

The trust level allows applications run with limited permission to ensure the environment secure. The trust levels of ASP.NET hosting are Full, High, Medium, Low and Minimal. Usually Full Trust is more expected than the others, because it is the most flexible configuration for running websites.

NO.6 Control Panel

When comes to the control panel of ASP.NET hosting, we usually prefer Plesk and WebSitePanel, because they are really reliable and also widely used in ASP.NET hosting. They have beautiful and concise interfaces which make the control panel to be very user-friendly. We recommend both the two to you.

NO.7 Dedicated Application Pool

Application pool on one server is usually shared by many websites. If the memory limit is reached, then the application pool will stop working and restart. So in order to avoid always being troubled by this problem, it is necessary to pay attention to whether your web host offers the dedicated application pool or not.

NO.8 ASP.NET Hosting Uptime

It may lead the websites lose lots of visitors if the downtime of a web host is very long. Almost every web host guarantees 99.9% uptime, but actually only a few of them meet their commitments based on our research in the past months. WinHost is a reliable one, its uptime is usually wonderful, and sometimes it even can reach 100.00%.

NO.9 ASP.NET Hosting Loading Speed

People all don’t like waiting, so the loading time also can influence the visitor numbers. A poor loading speed has a negative effect on customer conversion. Usually the disk storage of the hardware, the network, over-selling server and many other factors can affect loading speed.

NO.10 the Knowledge and Experience of Technical Support

If you are an non-technical person, some problems and difficulties may appear in your operation process, so a knowledge support team can be really necessary. Besides, if the web host is experienced with ASP.NET, it can also offer a worry free and convenient service for you.

ByAlexia Pamelov

Cheap Windows ASP.NET Tutorial – Steps for Session InProc Mode to Session ASP.NET State Server

CheapWindowsHosting.com | Cheap and reliable ASP.NET State server. ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support ASP.NET State server Service for session.

ahp new

Many articles are discussing about advantages of using Session StateServer or SQLServer over InProc Mode.  One basic reason why I choose StateServer Mode is when your website is running on Third Party Hosting than you will notice that Session Timeout can occur anytime depends on load of traffic on your server.

If your website has large number of visitors and session timeout can cause problem, It is better to change Session Mode Session=”InProc” to Session=”StateServer”.

Main Advantage of Session StateServer (Best to choose while hosting on third party server)

  • Session is persistent and reliable.
  • Avoid Session Timeout due to Memory shortage on server (IIS Setting).

Main Disadvantage

  • Poor Performance compare to Session=”InProc”
  • Session_End Event would not fire.

Now lets understand
Steps for changing Session InProc Mode to Session StateServer Mode.

Step 1:  Start Asp.net State Service

  1. Go to Control Panel > Administrative Tools > Services 
  2. Select Asp.Net State Service.
  3. Right Click on Asp.net State Service and choose start from popup menu.

service1

Start1

If you forget to Start Service you will receive following error.

Server Error in '/' Application.
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

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.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either ‘localhost’ or ‘127.0.0.1’ as the server name.

Step 2:  Change Session Mode in Web.Config File

sessionState mode="StateServer"
            stateConnectionString="tcpip=127.0.0.1:42424"
            cookieless="false"
            timeout="120"/>

Note: You can adjust timeout minutes based on your requirement.  Let the tcpip server to be localhost i.e. 127.0.0.1.  Most webhosting company uses these settings unless you have different IP for StateServer and  You are not required to change Port Number.

Step 3: Make All Object Serializable

You should make all object in your website to serializable.

Note: To take advantage of Session StateServer or SQLServer or Custom Mode, object needs to be serialized.

Example:  If your project contains class files for creating DAL (Data Access Layer), you should append Serializable to every class definition in order to make class Serializable.

Understanding Serialization in C#

Class Department

{
        long   _deptId;
        string _deptName;
        
        public long DeptId
        {
               get {   return _deptId; }
               set {  _deptId = value; }                  
         }

        public string DeptName
        {
               get {   return _deptName; }
               set {  _deptName = value; }                  
         }
}

IMPORTANT While doing Serialization
Remember SQLConnection cannot be serialized.
 
You might receive following error if you don’t handle this situation.

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

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.Web.HttpException: Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in ‘Custom’ mode.

So to handle this situation you need to do following thing

  • Mark SQLConnection Object as NonSerialized
    NonSerialized] protected SqlConnection _mainConnection;
  • Mark your Class as Serializable and derive from IDeserializationCallback
    Example:
Class Department: IDeserializationCallback

{
        long   _deptId;
        string _deptName;
        
        public long DeptId
        {
               get {   return _deptId; }
               set {  _deptId = value; }                  
         }

        public string DeptName
        {
               get {   return _deptName; }
               set {  _deptName = value; }                  
         }

        //Create this Method Inside your Class
       void IDeserializationCallback.OnDeserialization(object sender)
        {
            //Recreate your connection here
            _mainConnection = new SqlConnection();
            _mainConnection.ConnectionString =
                    ConfigurationSettings.AppSettings["connStr"].ToString();           
        }
}

 I hope this article helpful for you. Happy coding 🙂

Simpan

Simpan

Simpan