European Windows 2012 Hosting BLOG

BLOG about Windows 2012 Hosting and SQL 2012 Hosting - Dedicated to European Windows Hosting Customer

ASP.NET 4 European Hosting :: A Developer's Introduction to Windows Workflow Foundation (WF4) in .NET 4 Beta-Part 2

clock May 4, 2010 08:15 by author Scott

In our last post, we talk about a developer’s introduction to Windows Workflow Foundation (WF4) in .NET 4 Beta. Now, we will continue our journey.... Here we go!!

Building your first workflow

Now that we have covered the core concepts around Activity and data flow, we can create a workflow using these concepts.  We will start with a simple hello world workflow to focus on the concepts rather than the true value proposition of WF.  To start, create a new Unit Test project in Visual Studio 2010.  In order to use the core of WF, add a reference to the System.Activities assembly, and add using statements for System.Activities, System.Activities.Statements, and System.IO in the test class file. 

Tour of the workflow activity palette

With any programming language, you expect to have core constructs for defining your application logic.  When using a higher level development framework like WF, that expectation does not change.   Just as you have statements in .NET languages such as If/Else, Switch and While, for managing control flow you also need those same capabilities when defining your logic in a declarative workflow.  These capabilities come in the form of the base activity library that ships with the framework.  In this section, we will give you a quick tour of the activities that ship with the framework to give you an idea of the functionality provided out of the box.

Activity Primitives and Collection Activities

When moving to a declarative programming model, it is easy to begin wondering how to do common object manipulation tasks that are second nature when writing code.  For those tasks where you find yourself working with objects and needing to set properties, invoke commands or manage a collection of items, there are a set of activities designed specifically with those tasks in mind. 

1. Assign : Assigns a value to a location – enabling setting variables.
2. Delay : Delays the path of execution for a specified amount of time.
3. InvokeMethod/InvokeMethod<T> : Invokes a method on a .NET object or static method on a .NET type, optionally with a return type of T.
4. WriteLine : Writes specified text to a text writer – defaults to Console.Out
5. AddToCollection<T> : Adds an item to a typed collection.
6. RemoveFromCollection<T> : Removes an item from a typed collection.
7. ClearCollection<T> : Removes all items from a collection.
8. ExistsInCollection<T> : Returns a Boolean value indicating if the specified item exists in the collection. 

Control Flow Activities

When defining business logic or business processes, having control of the flow of execution is critical. Control flow activities include basics such as Sequence which provides a common container when you need to execute steps in order, and common branching logic such as the If and Switch activities.  The control flow activities also include looping logic based on data (ForEach) and Conditions(While).  Most important for simplifying complex programming are the parallel activities, which all enable multiple asynchronous activities to get work done at the same time. 

1. Sequence : For executing activities in series
2. While/DoWhile : Executes a child activity while a condition (expression) is true
3. ForEach/ForEach<T> : Iterates over an enumerable collection and executes the child activity once for each item in the collection, waiting for the child to complete before starting the next iteration.  ForEach<T> provides typed access to the individual item driving the iteration.
4. If : Executes one of two child activities depending on the result of the condition (expression).
5. Switch<T> : Evaluates an expression and schedules the child activity with a matching key. 
6. Parallel : Schedules all child activities at once, but also provides a completion condition to enable the activity to cancel any outstanding child activities if certain conditions are met. 
7. ParallelForEach/ParallelForEach<T> : Iterates over an enumerable collection and executes the child activity once for each item in the collection, scheduling all instances at the same time.
8. Pick : Schedules all child PickBranch activities and cancels all but the first to have its trigger complete.  The PickBranch activity has both a Trigger and an Action; each is an Activity.  When a trigger activity completes, the Pick cancels all its other child activities. 

Flowchart

When designing Flowchart workflows there are several constructs that can be used to manage the flow of execution within the Flowchart.  These constructs themselves provide simple steps, simple decision points based on a single condition, or a switch statement.  The real power of the Flowchart is the ability to connect these node types into the desired flow.

1. Flowchart : The container for a series of flow steps, each flow step can be any activity or one of the following constructs, but to be executed, it must be connected within the Flowchart. 
2. FlowDecision : Provides branching logic based on a condition.
3. FlowSwitch / FlowSwitch<T> : Enables multiple branches based on the value of an expression. 
4. FlowStep : Represents a step in the Flowchart with the ability to be connected to other steps. This type is not shown in the toolbox as it is implicitly added by the designer.  This activity wraps other activities in the workflow and provides the navigation semantics for the next step(s) in the workflow. 

It is important to note that while there are specific activities for the Flowchart model, any other activities can be used within the workflow.  Likewise, a Flowchart activity can be added to another activity to provide the execution and design semantics of a Flowchart, within that workflow.  This means you can have a sequence with a several activities and a Flowchart right in the middle. 

Messaging Activities

One of the major focuses in WF4 is tighter integration between WF and WCF.  In terms of workflows, that means activities to model messaging operations such as sending and receiving messages.  There are actually several different activities included in the framework for messaging, each with slightly different functionality and purpose.

1. Send/Receive : One way messaging activities to send or receive a message.  These same activities are composed into request/response style interactions. 
2. ReceiveAndSendReply : Models a service operation that receives a message and sends back a reply. 
3. SendAndReceiveReply : Invokes a service operation and receives the response. 
4. InitializeCorrelation : Allow for initializing correlation values explicitly as part of the workflow logic, rather than extracting the values from a message.
5. CorrelationScope : Defines a scope of execution where a correlation handle is accessible to receive and send activities simplifying the configuration of a handle that is shared by several messaging activities. 
6. TransactedReceiveScope : Enables workflow logic to be included in the same transaction flowed into a WCF operation using the Receive activity.

Transactions and Error Handling

Writing reliable systems can be difficult, and requires that you do a good job of handling errors and managing to keep consistent state in your application.  For a workflow, scopes for managing exception handling and transactions are modeled using activities with properties of type ActivityAction or Activity to enable developers to model error processing logic.  Beyond these common patterns of consistency, WF4 also includes activities which allow you to model  long running distributed  coordination through compensation and confirmation. 

1. CancellationScope : Used to allow the workflow developer to react if a body of work gets cancelled. 
2. TransactionScope :  Enables semantics similar  to using a transaction scope in code by executing all child activities in the scope under a transaction. 
3. TryCatch/Catch<T> : Used to model exception handling and catch typed exceptions. 
4. Throw : Can be used to throw an exception from the activity.  
5. Rethrow : Used to rethrow an exception, generally one that has been caught using the TryCatch activity. 
6. CompensableActivity : Defines the logic for executing child activities that may need to have their actions compensated for after success.  Provides a placeholder for the compensation logic, confirmation logic, and cancellation handling.
7. Compensate : Invokes the compensation handling logic for a compensable activity.
8. Confirm : Invokes the confirmation logic for a compensable activity. 

Options for executing workflows

In order to execute a workflow, you need an Activity that defines the workflow.  There are two typical ways to get an Activity that can be executed: create it in code or read  in a XAML file and deserialize the content into an Activity.  The first option is straightforward and I have already shown several examples.  To load a XAML file you should use the ActivityXamlServices class which provides a static Load method.  Simply pass in a Stream or XamlReader object and you get back the Activity represented in the XAML.  

Once you have an Activity, the simplest way to execute it is by using the WorkflowInvoker class as I did in the unit tests earlier.  The Invoke method of this class has a parameter of type Activity and returns an IDictionary<string, object>.  If you need to pass arguments into the workflow, you first define them on the workflow and then pass the values along with the Activity, into the Invoke method as dictionary of name/value pairs.  Likewise, any Out or In/Out arguments defined on the workflow will be returned as the result of executing the method.  We provide an example of loading a workflow from a XAML file, passing arguments into the workflow and retrieving the resulting output arguments. 

Activity mathWF;

using (Stream mathXaml = File.OpenRead("Math.xaml"))

{

    mathWF = ActivityXamlServices.Load(mathXaml);

}

var outputs = WorkflowInvoker.Invoke(mathWF,

    new Dictionary<string, object> {

    { "operand1", 5 },

    { "operand2", 10 },

    { "operation", "add" } });

Assert.AreEqual<int>(15, (int)outputs["result"], "Incorrect result returned");

Notice in this example that the Activity is loaded from a XAML file and it can still accept and return arguments.  The workflow was developed using the designer in Visual Studio for ease, but could be developed in a custom designer and stored anywhere.  The XAML could be loaded from a database, SharePoint library, or some other store before being handed to the runtime for execution.  

Using the WorkflowInvoker provides the simplest mechanism for running short-lived workflows.  It essentially makes the workflow act like a method call in your application, enabling you to more easily take advantage of all the benefits of WF without having to do a lot of work to host WF itself.  This is especially useful when unit testing your activities and workflows as it reduces the test setup necessary to exercise a component under test. 

Another common hosting class is the WorkflowApplication which provides a safe handle to a workflow that is executing in the runtime, and enables you to manage long running workflows more easily.  With the WorkflowApplication, you can still pass arguments into the workflow in the same way as with the WorkflowInvoker, but you use the Run method to actually start the workflow running.  At this point, the workflow begins executing on another thread and control returns to the calling code. 

Because the workflow is now running asynchronously, in your hosting code you will likely want to know when the workflow completes, or if it throws an exception, etc.  For these types of notifications, the WorkflowApplication class has a set of properties of type Action<T> that can be used like events to add code to react to certain conditions of the workflow execution including: aborted, unhandled exception, completed, idled, and unloaded.  When you execute a workflow using WorkflowApplication, you can use code similar to that shown in Figure below using actions to handle the events. 

WorkflowApplication wf = new WorkflowApplication(new Flowchart1());

wf.Completed = delegate(WorkflowApplicationCompletedEventArgs e)

{

    Console.WriteLine("Workflow {0} complete", e.InstanceId);

};

wf.Aborted = delegate(WorkflowApplicationAbortedEventArgs e)

{

    Console.WriteLine(e.Reason);

};

wf.OnUnhandledException =

  delegate(WorkflowApplicationUnhandledExceptionEventArgs e)

  {

      Console.WriteLine(e.UnhandledException.ToString());

      return UnhandledExceptionAction.Terminate;

  };

wf.Run();

In this example, the goal of the host code, a simple console application, is to notify the user via the console when the workflow completes or if an error occurs.  In a real system, the host will be interested in these events and will likely react to them differently to provide administrators with information about failures or to better manage the instances.

TO BE CONTINUED
Always stay with us…. Don’t go anywhere!! We will continue the final part..

Top Reasons to host your ASP.NET 4 Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



ASP.NET 4 European Hosting :: A Developer's Introduction to Windows Workflow Foundation (WF4) in .NET 4 Beta-Part 2

clock May 4, 2010 08:15 by author Scott

In our last post, we talk about a developer’s introduction to Windows Workflow Foundation (WF4) in .NET 4 Beta. Now, we will continue our journey.... Here we go!!

Building your first workflow

Now that we have covered the core concepts around Activity and data flow, we can create a workflow using these concepts.  We will start with a simple hello world workflow to focus on the concepts rather than the true value proposition of WF.  To start, create a new Unit Test project in Visual Studio 2010.  In order to use the core of WF, add a reference to the System.Activities assembly, and add using statements for System.Activities, System.Activities.Statements, and System.IO in the test class file. 

Tour of the workflow activity palette

With any programming language, you expect to have core constructs for defining your application logic.  When using a higher level development framework like WF, that expectation does not change.   Just as you have statements in .NET languages such as If/Else, Switch and While, for managing control flow you also need those same capabilities when defining your logic in a declarative workflow.  These capabilities come in the form of the base activity library that ships with the framework.  In this section, we will give you a quick tour of the activities that ship with the framework to give you an idea of the functionality provided out of the box.

Activity Primitives and Collection Activities

When moving to a declarative programming model, it is easy to begin wondering how to do common object manipulation tasks that are second nature when writing code.  For those tasks where you find yourself working with objects and needing to set properties, invoke commands or manage a collection of items, there are a set of activities designed specifically with those tasks in mind. 

1. Assign : Assigns a value to a location – enabling setting variables.
2. Delay : Delays the path of execution for a specified amount of time.
3. InvokeMethod/InvokeMethod<T> : Invokes a method on a .NET object or static method on a .NET type, optionally with a return type of T.
4. WriteLine : Writes specified text to a text writer – defaults to Console.Out
5. AddToCollection<T> : Adds an item to a typed collection.
6. RemoveFromCollection<T> : Removes an item from a typed collection.
7. ClearCollection<T> : Removes all items from a collection.
8. ExistsInCollection<T> : Returns a Boolean value indicating if the specified item exists in the collection. 

Control Flow Activities

When defining business logic or business processes, having control of the flow of execution is critical. Control flow activities include basics such as Sequence which provides a common container when you need to execute steps in order, and common branching logic such as the If and Switch activities.  The control flow activities also include looping logic based on data (ForEach) and Conditions(While).  Most important for simplifying complex programming are the parallel activities, which all enable multiple asynchronous activities to get work done at the same time. 

1. Sequence : For executing activities in series
2. While/DoWhile : Executes a child activity while a condition (expression) is true
3. ForEach/ForEach<T> : Iterates over an enumerable collection and executes the child activity once for each item in the collection, waiting for the child to complete before starting the next iteration.  ForEach<T> provides typed access to the individual item driving the iteration.
4. If : Executes one of two child activities depending on the result of the condition (expression).
5. Switch<T> : Evaluates an expression and schedules the child activity with a matching key. 
6. Parallel : Schedules all child activities at once, but also provides a completion condition to enable the activity to cancel any outstanding child activities if certain conditions are met. 
7. ParallelForEach/ParallelForEach<T> : Iterates over an enumerable collection and executes the child activity once for each item in the collection, scheduling all instances at the same time.
8. Pick : Schedules all child PickBranch activities and cancels all but the first to have its trigger complete.  The PickBranch activity has both a Trigger and an Action; each is an Activity.  When a trigger activity completes, the Pick cancels all its other child activities. 

Flowchart

When designing Flowchart workflows there are several constructs that can be used to manage the flow of execution within the Flowchart.  These constructs themselves provide simple steps, simple decision points based on a single condition, or a switch statement.  The real power of the Flowchart is the ability to connect these node types into the desired flow.

1. Flowchart : The container for a series of flow steps, each flow step can be any activity or one of the following constructs, but to be executed, it must be connected within the Flowchart. 
2. FlowDecision : Provides branching logic based on a condition.
3. FlowSwitch / FlowSwitch<T> : Enables multiple branches based on the value of an expression. 
4. FlowStep : Represents a step in the Flowchart with the ability to be connected to other steps. This type is not shown in the toolbox as it is implicitly added by the designer.  This activity wraps other activities in the workflow and provides the navigation semantics for the next step(s) in the workflow. 

It is important to note that while there are specific activities for the Flowchart model, any other activities can be used within the workflow.  Likewise, a Flowchart activity can be added to another activity to provide the execution and design semantics of a Flowchart, within that workflow.  This means you can have a sequence with a several activities and a Flowchart right in the middle. 

Messaging Activities

One of the major focuses in WF4 is tighter integration between WF and WCF.  In terms of workflows, that means activities to model messaging operations such as sending and receiving messages.  There are actually several different activities included in the framework for messaging, each with slightly different functionality and purpose.

1. Send/Receive : One way messaging activities to send or receive a message.  These same activities are composed into request/response style interactions. 
2. ReceiveAndSendReply : Models a service operation that receives a message and sends back a reply. 
3. SendAndReceiveReply : Invokes a service operation and receives the response. 
4. InitializeCorrelation : Allow for initializing correlation values explicitly as part of the workflow logic, rather than extracting the values from a message.
5. CorrelationScope : Defines a scope of execution where a correlation handle is accessible to receive and send activities simplifying the configuration of a handle that is shared by several messaging activities. 
6. TransactedReceiveScope : Enables workflow logic to be included in the same transaction flowed into a WCF operation using the Receive activity.

Transactions and Error Handling

Writing reliable systems can be difficult, and requires that you do a good job of handling errors and managing to keep consistent state in your application.  For a workflow, scopes for managing exception handling and transactions are modeled using activities with properties of type ActivityAction or Activity to enable developers to model error processing logic.  Beyond these common patterns of consistency, WF4 also includes activities which allow you to model  long running distributed  coordination through compensation and confirmation. 

1. CancellationScope : Used to allow the workflow developer to react if a body of work gets cancelled. 
2. TransactionScope :  Enables semantics similar  to using a transaction scope in code by executing all child activities in the scope under a transaction. 
3. TryCatch/Catch<T> : Used to model exception handling and catch typed exceptions. 
4. Throw : Can be used to throw an exception from the activity.  
5. Rethrow : Used to rethrow an exception, generally one that has been caught using the TryCatch activity. 
6. CompensableActivity : Defines the logic for executing child activities that may need to have their actions compensated for after success.  Provides a placeholder for the compensation logic, confirmation logic, and cancellation handling.
7. Compensate : Invokes the compensation handling logic for a compensable activity.
8. Confirm : Invokes the confirmation logic for a compensable activity. 

Options for executing workflows

In order to execute a workflow, you need an Activity that defines the workflow.  There are two typical ways to get an Activity that can be executed: create it in code or read  in a XAML file and deserialize the content into an Activity.  The first option is straightforward and I have already shown several examples.  To load a XAML file you should use the ActivityXamlServices class which provides a static Load method.  Simply pass in a Stream or XamlReader object and you get back the Activity represented in the XAML.  

Once you have an Activity, the simplest way to execute it is by using the WorkflowInvoker class as I did in the unit tests earlier.  The Invoke method of this class has a parameter of type Activity and returns an IDictionary<string, object>.  If you need to pass arguments into the workflow, you first define them on the workflow and then pass the values along with the Activity, into the Invoke method as dictionary of name/value pairs.  Likewise, any Out or In/Out arguments defined on the workflow will be returned as the result of executing the method.  We provide an example of loading a workflow from a XAML file, passing arguments into the workflow and retrieving the resulting output arguments. 

Activity mathWF;

using (Stream mathXaml = File.OpenRead("Math.xaml"))

{

    mathWF = ActivityXamlServices.Load(mathXaml);

}

var outputs = WorkflowInvoker.Invoke(mathWF,

    new Dictionary<string, object> {

    { "operand1", 5 },

    { "operand2", 10 },

    { "operation", "add" } });

Assert.AreEqual<int>(15, (int)outputs["result"], "Incorrect result returned");

Notice in this example that the Activity is loaded from a XAML file and it can still accept and return arguments.  The workflow was developed using the designer in Visual Studio for ease, but could be developed in a custom designer and stored anywhere.  The XAML could be loaded from a database, SharePoint library, or some other store before being handed to the runtime for execution.  

Using the WorkflowInvoker provides the simplest mechanism for running short-lived workflows.  It essentially makes the workflow act like a method call in your application, enabling you to more easily take advantage of all the benefits of WF without having to do a lot of work to host WF itself.  This is especially useful when unit testing your activities and workflows as it reduces the test setup necessary to exercise a component under test. 

Another common hosting class is the WorkflowApplication which provides a safe handle to a workflow that is executing in the runtime, and enables you to manage long running workflows more easily.  With the WorkflowApplication, you can still pass arguments into the workflow in the same way as with the WorkflowInvoker, but you use the Run method to actually start the workflow running.  At this point, the workflow begins executing on another thread and control returns to the calling code. 

Because the workflow is now running asynchronously, in your hosting code you will likely want to know when the workflow completes, or if it throws an exception, etc.  For these types of notifications, the WorkflowApplication class has a set of properties of type Action<T> that can be used like events to add code to react to certain conditions of the workflow execution including: aborted, unhandled exception, completed, idled, and unloaded.  When you execute a workflow using WorkflowApplication, you can use code similar to that shown in Figure below using actions to handle the events. 

WorkflowApplication wf = new WorkflowApplication(new Flowchart1());

wf.Completed = delegate(WorkflowApplicationCompletedEventArgs e)

{

    Console.WriteLine("Workflow {0} complete", e.InstanceId);

};

wf.Aborted = delegate(WorkflowApplicationAbortedEventArgs e)

{

    Console.WriteLine(e.Reason);

};

wf.OnUnhandledException =

  delegate(WorkflowApplicationUnhandledExceptionEventArgs e)

  {

      Console.WriteLine(e.UnhandledException.ToString());

      return UnhandledExceptionAction.Terminate;

  };

wf.Run();

In this example, the goal of the host code, a simple console application, is to notify the user via the console when the workflow completes or if an error occurs.  In a real system, the host will be interested in these events and will likely react to them differently to provide administrators with information about failures or to better manage the instances.

TO BE CONTINUED
Always stay with us…. Don’t go anywhere!! We will continue the final part..

Top Reasons to host your ASP.NET 4 Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



IIS 7.5 European Hosting :: Configuring Windows Server 2008 Core Basic Networking Settings

clock May 4, 2010 08:08 by author Scott

Like any other server, Server Core machines must be properly configured to be able to communicate on your network. Some of these settings include:

- Configuring an IP address
- Configuring an administrator's password
- Configuring a server name
- Enabling remote MMC snap-in management
- Enabling remote RDP connections
- Enabling remote Windows Firewall management
- Enabling remote shell management
- Activating the server
- Joining a domain
- Configuring Windows Updates
- Configuring error reporting
- Adding server roles and features

And other tasks.

Before you start, you need to configure the server's IP address.

To set the server with a static IP address

1. At a command prompt, type the following:

netsh interface ipv4 show interfaces

2. Look at the number shown in the Idx column of the output for your network adapter. If your computer has more than one network adapter, make a note of the number corresponding to the network adapter for which you wish to set a static IP address.

3. At the command prompt, type:

netsh interface ipv4 set address name=”” source-static address= mask = gateway =

Where:
- ID is the number from step 2 above
- StaticIP is the static IP address that you are setting
- SubnetMask is the subnet mask for the IP address
- DefaultGateway is the default gateway

4. At the command prompt, type:

netsh interface ip4 add dnsserver name=”” address= index= 1

Where:
- ID is the number from step 2 above
- DNSIP is the IP address of your DNS server

5. Repeat step 4 for each DNS server that you want to set, incrementing the index= number each time.

6. Verify by typing ipconfig /all and checking that all the addresses are correct.

To set the administrative password in Windows Server 2008

1. At a command prompt, type the following:

net user administrator *

2. When prompted to enter the password, type the new password for the administrator user account and press ENTER.

3. When prompted, retype the password and press ENTER.

Next, you might want to change the computer's name, as the default name is a random-generated name (unless configured through an answer file)

To change the name of the server

1. Determine the current name of the server with the hostname or ipconfig /all commands.

2. At a command prompt, type:

netdom rename computer /NewName:

3. Restart the computer by typing the following at a command prompt:

shutdown /r /t 0

To manage a server running a Server Core Installation by using the Windows Remote Shell

1. To enable Windows Remote Shell on a server running a Server Core installation, type the following command at a command prompt:

WinRm quickconfig

2. Click Y to accept the default settings. Note: The WinRM quickconfig setting enables a server running a Server Core installation to accept Windows Remote Shell connections.

3. On the remote computer, at a command prompt, use WinRS.exe to run commands on a server running a Server Core installation. For example, to perform a directory listing of the Windows folder, type:

Winrs –r: cmd

Where ServerName is the name of the server running a Server Core installation.

4. You can now type any command that you require, it will be executed on the remote computer.

To activate the server

1. At a command prompt, type:

slmgr.vbs -ato

If activation is successful, no message will return in the command prompt.

To activate the server remotely

1. At a command prompt, type:

cscript slmgr.vbs –ato

2. Retrieve the GUID of the computer by typing:

cscript slmgr.vbs –did

3. Type

cscript slmgr.vbs –dli

4. Verify that License status is set to Licensed (activated).

To join a Windows 2008 server to a domain

1. At a command prompt, type:

netdom join /domain: /userd: /password:*

Where:
- ComputerName is the name of the server that is running the Server Core installation.
- DomainName is the name of the domain to join.
- UserName is a domain user account with permission to join the domain.

Note: Entering * as the password means you will be prompted to enter it on the command prompt window in the next step. You can enter it in the initial command, if you wish to. Note: Note that the word "passwordd" has 2 d's in it…


2. When prompted to enter the password, type the password for the domain user account specified by UserName.

3. Restart the computer by typing the following at a command prompt:

shutdown /r /t 0

To remove the Windows 2008 server from a domain

1. At a command prompt, type:

netdom remove

2. Reboot the computer.

To configure automatic updates

1. To enable automatic updates, type:

cscript C:’Windows’System32’Scgredit.wsf /au 4

2. To disable automatic updates, type:

cscript C:’Windows’System32’Scgredit.wsf /au 1

BTW, in order to view your current settings you can type:

cscript C:’Windows’System32’Scgredit.wsf /au /v

To configure error reporting

1. To verify the current setting, type:

serverWerOptin /query

2. To automatically send detailed reports, type:

serverWerOptin /detailed

3. To automatically send summary reports, type:

serverWerOptin /summary

4. To disable error reporting, type:

serverWerOptin /disable

Summary

Windows Server 2008 Core machines need to be properly configured for communication across your network. While most of the Server Core settings need to be configured via the local Command Prompt, some settings can also be configured remotely. This article, a part of a complete Server Core article series, will show you how to do that. So, if you want to be more familiar with Windows Server 2008, you should try HostForLife.eu. Only with € 3.00/month, you can get a reasonable price with best service.

Top Reasons to host your ISS 7.5 Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



Silverlight 3 European Hosting :: Working with Data Services in Silverlight 3 - WCF vs REST

clock May 3, 2010 08:12 by author Scott

Here we'll delve into the latter Silverlight 3 feature by comparing the options developers have for communicating with services from Silverlight. We'll do so by building a sample application called Cooking with Silverlight, a fictitious site where people can search in a recipe database and read reviews of recipes. We'll start by showing options for exchanging information with a Windows Communication Foundation (WCF) service. After that, We'll build the same application, but now using representational state transfer (REST) services. These two examples will demonstrate the differences between communicating with WCF or REST in a Silverlight app. You can download the complete code for this article by clicking the above link.

Working with Data in a Silverlight App

Silverlight uses the same Base Class Library (BCL) as the full .NET Framework, however, only a subset is available in the Silverlight platform. When browsing the assemblies, you'll quickly notice that many familiar data-related assemblies and classes are missing. Indeed, Silverlight does not contain ADO.NET and has no support for a DataSet or DataReader. In Silverlight 3, the current version at the time of writing, Silverlight has no client-side database access available, and it isn't possible to have a connection string in your Silverlight application, which would allow remote database access.

However, enterprise applications are built around data. To solve this problem, Silverlight can connect with services, on the same server on which the Silverlight app is hosted or on another server, if it complies with a few characteristics, which we'll look at in the cross-domain section of this article. Using services, we can satisfy almost every requirement for working with data in a Silverlight application. Even if we had a client-side database implementation, we'd still have the services required to use up-to-date information.

Out of the box, Silverlight can connect with several types of services, including WCF and REST. Let's first look at how the sample application was built and compare where the two technologies differ from one another.

Silverlight and WCF

WCF is the preferred way of building services in the .NET Framework. Designing a WCF service for use with Silverlight isn't much different from designing the service for use with any other technology. The main difference is the type of binding used for the communication. By default, when you add a WCF service to a project, it's configured to use a wsHttpBinding. In general, a wsHttpBinding supports distributed transactions and secure sessions. Silverlight, however, can't work with this type of binding; instead a basicHttpBinding is required. A basicHttpBinding essentially allows communication with a traditional ASMX web service (based on WS-BasicProfile 1.1) and lacks the options offered by the wsHttpBinding, such as secure sessions.

This means that all data is transmitted as plain XML in a SOAP message. In enterprise environments, this could be risky. To counter this risk, one possible solution is using ASP.NET authentication to allow access only to authenticated users on the services. 

Visual Studio offers a Silverlight-enabled WCF service template. This template sets the correct type of binding in the configuration file.

Creating the WCF Service

A WCF service typically offers a service contract. The service contract offered by the service defines the operations exposed by the service. Each operation that needs to be exposed over the service is attributed with an OperationContractAttribute.

The implementation of the service, contained in the *.svc.cs file in a WCF scenario, contains the logic for accessing the data using the repository and returning a list of DTOs.

Using the WCF Service from the Silverlight Client

With the service in place, the Silverlight application needs to connect with it. WCF services are said to be self-describing: They expose a Web Services Description Language (WSDL) file, which contains metadata about the service. This metadata describes, among other things, the operations and data contracts exposed by the service. When you connect to such a service using Visual Studio's Add Service Reference dialog box, the IDE will generate a proxy class. This proxy contains a client-side copy of the service. The proxy class contains all operations, without the implementations, and a copy of the data contracts. Because of this, we get full IntelliSense in the editor when working with the service.

To execute a call to the service, we use this proxy class. However, when the application accesses a service from Silverlight, the call will be executed asynchronously. If synchronous calls were possible, during the call's execution the browser would remain blocked while awaiting a response from the server.

A callback method is specified for the XXX_Completed event. This method is executed when the service returns. Making the actual async call to the service is done using the XXXAsync method. Inside the callback method, the result of the service call is accessible through the e.Result property. This property's type is the same type as returned by the service. These types were generated when the proxy was created upon adding the service reference. We're using the result, here a generic List of Recipe instances, as the ItemsSource for the ListBox. Of course, other data-binding scenarios are possible here.

Silverlight and REST

The biggest advantage of using WCF services is the typed access, which is based on the metadata that the service exposes. This makes the process of writing the client-side code easier. However, not every service exposes metadata. Some services work with human-readable information, mostly in the form of XML, which they send following a request from the client.

This is the case for REST services. Compared with WCF, REST has some advantages. As said, the information is exchanged as pure XML (or JavaScript Object Notation—JSON, if needed). The XML is clean and more lightweight than the SOAP messages exchanged when using WCF. Thus, less data will go over the wire, resulting in faster transfer of the data. REST is also entirely platform independent: It requires no extra software as it relies on standard HTTP methods. However, because REST services are not self-describing, Visual Studio can't generate a proxy class. This means that when writing a Silverlight application that needs to work with a REST service, we manually need to parse the returned XML to capture the server's response. Luckily, Silverlight includes LINQ to XML, making this process much easier. Alternatively, you could use the XmlReader/XmlWriter or the XmlSerializer for this task.

Creating the REST Service

A REST service will send data when it's requested to do so. The request is done over HTTP, for example, by sending a request to a specific URL. The REST service will then respond by sending XML over the wire.

To create a REST service, we can use WCF as well. However, we need to perform some configuration changes to enable the WCF services to work as REST services.

The service operations in the service contract need to be attributed with WebGetAttribute in addition to the OperationContractAttribute. The UriTemplate defines what the URL should look like and which parameters it should contain to get access to the associated operation.

The implementation of the service operation is almost identical to the WCF implementation, as you can see in the previous listings. To test the service and see its response, navigate for example to http://localhost:1234/ RestRecipeService.svc/recipe/find/pancake.

For the sample application, we wrote the REST service ourselves. It's also possible to use one of the numerous, often free, REST service APIs available, such as Twitter, Flickr, or Facebook. Looking at those APIs, it's easy to see that their XML is also the contract for data exchange between a client application and the service.

Using the REST Service from the Silverlight Client

Since there's no metadata available on a REST service, we can't add a service reference to it from Visual Studio. We need another approach.

Using a REST service from Silverlight is a three-step process. Step one: Build the URL to which we need to send a request. The format of this URL is defined by the service and may contain parameters that we must provide as well. Step two: Send a request to that URL. And finally, step 3: Wait for the result to come in as XML or JSON and parse this accordingly.

Building the URL is pretty straightforward. It's constructed by gluing together the URL from the service project with the string defined as value for the UriTemplate. You can send a request to this URL by using either the WebClient or the HttpWebRequest class, both part of the System.Net namespace and also classes included in the full .NET Framework. For most situations, the WebClient will suffice; if you need more fine-grained control over the request, the HttpWebRequest is the best bet. The WebClient is basically a wrapper around the HttpWebRequest with an easier API: Using the WebClient under the covers still uses methods of the HttpWebRequest. We'll use the WebClient here as well.

Cross-Domain Access

When accessing services, Silverlight will not allow access of these services by default if they're hosted on a domain other than the domain hosting the Silverlight application. In other words, if we have a Silverlight application called CookingWithSilverlight.xap hosted on http://www.somedomain.com, the application can't access a service on http://www.someotherdomain.com unless that service specifically grants a right to access it from a client application hosted on another domain. This feature is called cross-domain restrictions and is basically a security measurement to prevent cross-domain attacks.

How can a service allow the access anyway? When a cross-domain service request is launched, Silverlight will check for a file called ClientAccessPolicy.xml at the root of the domain (it will also check for crossdomain.xml, which is the policy file that Adobe Flash checks for). If this file is present and allows the call to be made, Silverlight will access the service. If the file isn't present or we're accessing from a domain that isn't on the list of allowed domains, Silverlight will block the request, resulting in a security exception being thrown.

Cross-domain restrictions apply for both WCF and REST services. Accessing an image or a video on another domain doesn't trigger this check. In the sample application, both the WCF and REST services are hosted in a website different from the one hosting the Silverlight application. In both websites, at the root, a policy file can be found, allowing access from any domain.

Two Services Options for Silverlight Developers

Both WCF and REST have their strong points. WCF really benefits from the fact that it exposes metadata that can be used to generate a proxy class. During development, this results in IntelliSense picking up the types and operations of the services, which makes things much easier. Features like easy duplex communication and binary XML data exchange make WCF in Silverlight quite complete. All SOAP 1.1–enabled services, even if they're exposed from technology other than .NET, can be used from Silverlight in the same manner. In most enterprises, SOAP-enabled services are the standard.

However, we don't always have—or need—all the options made available by WCF. If the data being exchanged is pure text, we can use REST. It's simple, fast, and is based on the HTTP standard methods, requiring no special software. Many large Web 2.0 sites expose an API that uses REST. Working with this type of services does require some more manual work, in that we have to send the request, capture the results, and parse them into meaningful data.

Regardless of what type of service is used, the communication happens asynchronously. In the case of WCF, when the proxy class is generated, both the XXXAsync method and the XXX_Completed event are created. When using REST, the WebClient has a DownloadStringAsync and a DownloadStringCompleted event.

Top Reasons to host your Silverlight 3 Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



ASP NET MVC European Hosting :: What's New in ASP.NET MVC 2.0

clock May 3, 2010 07:35 by author Scott

Are you looking for an affordable hosting service? Are you looking for good service at affordable prices? Try HostForLife.eu, only with € 3.00/month, you can get a reasonable price with best service. This topic contains only brief information about ASP.NET MVC, if you want to be more familiar with ASP.NET MVC, you should try HostForLife.eu.

Introduction

Overall, ASP.NET is one of the most popular web application frameworks along with PHP, Java and others. However, the classic ASP.NET WebForms style of application development also has its limitations. For instance, cleanly separating the user interface from the application logic and database access can be a challenge in WebForms applications. Thus, Microsoft created ASP.NET MVC. MVC stands for Model View Controller.

The ASP.NET MVC technology has already been introduced earlier (see the Resources section at the end of this article), and thus this article focuses on the new and improved features planned for .NET Framework version 4.0 that should become available in Spring, 2010. Originally Microsoft announced Visual Studio 2010 would launch on March 22nd, 2010, but most recent announcements indicate delays. As far as version numbers are concerned, the next version of ASP.NET MVC will be assigned the version number 2.0. In this article, you will learn what's new and improved in the newest Release Candidate (RC) version of ASP.NET MVC 2. At the time of this writing (late December, 2009) the latest beta version of Visual Studio 2010 is Beta 2, and it doesn't yet come with the ASP.NET MVC 2 RC. The unfortunate thing is that if you are using Visual Studio 2010 Beta 2, you cannot yet test MVC 2 RC with that version (you can naturally continue to use the older Beta 2 version). Instead, you must test the MVC 2 RC on Visual Studio 2008 SP1.

Of course, the final versions of ASP.NET MVC 2 are planned to work with both Visual Studio 2008 and 2010, so the current is only an interim situation.

Exploring the New Features

ASP.NET MVC 2 is an evolutional update to the framework. The basic features of the original version 1.0 are intact, but new features make development easier and result in cleaner code. The following list summarizes the key new features:

1. Area support and multi-project routing
2. Improved syntax for handling posts (form submits) in controllers
3. HtmlHelper object improvements
4. Attribute support for field validation in models
5. Globalization of validation messages
6. Field templates with custom user controls, and more.

Let's walk through each of these in more detail, starting from the top. In MVC 1.0, each view page was thought of as being a separate unit, and served to the browser as a single unit, possibly combined with a master page. However, if you wanted to combine, say, two views into a single page, you either had to manually render one of the pages or create a user control (.ascx) from one of the views, and then use that control inside the main view page. Although user controls are a fine solution, they break out of the MVC pattern.

In MVC 2, you can utilize so-called areas to solve the problem. With area support, you can combine different view pages into a single, larger view similar to the way you can build master pages (.master) and designate parts of them to be filled with content at run-time. It is possible to combine areas into views both inside a single MVC web project ("intra-project areas"), or combine areas in different projects into views ("inter-project areas"), accessible through direct URLs in the same scope.project ("intra-project areas"), or combine areas in different projects into views ("inter-project areas"), accessible through direct URLs in the same scope.

The following paragraphs walk you through using areas inside a single project. If you wanted to combine multiple MVC web projects into a single larger application, you would need to manually edit the .csproj project files of each project part of the overall solution (the edits you need to do are documented in the .csproj XML comments), add proper project references from the child projects to the master project, and then register routes using the MapAreaRoute method of the Routes object in the Global.asax file. In this article, focus is on single-project area support.

To get started with the areas, right-click your project's main node in Solution Explorer, and select the Add/Area command from the popup menu. This will open a dialog box asking for the name of your new area. Unlike with controller names, you don't need to append the word "Area" to the name, but you can if you prefer. However, bear in mind that intra-project areas will be accessed using the default route of /areaname/controllername/action/id. Because of this, you might not want to suffix the word "Area". In this article however, the word "Area" is appended for clarity.

Once you have created your area, Visual Studio will add a new folder called "Areas" in your project. This folder will contain a sub-folder with the name of your area, and inside that you will see a familiar layout of folders for controllers, views and models. In fact, you would add controllers, views and models to this area folder just the same as you would add them to your "master" MVC project. All in all, an area is like a mini MVC application inside another. Note also the
AreaRegistration.cs code file. This file's definitions are referenced to from the Global.asax.cs file.

Areas can be used in multiple ways. Because they are directly accessible using the previously mentioned default route, you can utilize them like any other link inside your application. Or, if you had an area controller action that would return a snippet of HTML code to be used inside a larger HTML page (a normal view page), you could use the HtmlHelper.RenderAction as follows:

<% Html.RenderAction("NetworkStatus", "Application", new { Area = "StatusArea" }); %>

Notice how there's an anonymous object being used to specify which area you want to use. Because areas can be completely independent of the master project, you can easily create usable parts or building blocks from your MVC applications and then combine them into larger solutions.

Area support is a very welcome addition to the framework. Luckily to us developers, area support is by no means the only new feature in ASP.NET MVC 2, like the next sections show.

Handling posts and encoding

When you need to handle form posts in your MVC applications, you generally write a new, overloaded controller action method to process the submitted data, and store it for example in a database. Since you only want these methods to be called using the HTTP protocol POST verb, you add an attribute at the beginning of the method like this:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult MyAction(MyObject data)
...

Although there's nothing wrong in the AcceptVerbs attribute, ASP.NET MVC 2 allows you to achieve the same thing with a shorter attribute declaration:

[HttpPost]
public ActionResult MyAction(MyObject data)
...

Even though this is a small improvement, it is very likely that all MVC developers give it a warm welcome. Another useful new improvement is the support for automatically encoded output tags in view pages. Strictly speaking, this is not a new ASP.NET MVC feature, but instead a feature in ASP.NET 4.0. Even so, this new tag type is especially useful in MVC applications.

To illustrate the new tag, consider the following very common need to encode output for HTML:

<%= Model.CustomerName %>

This is a very simple tag, and works well in many situations. However, if the customer name were to contain certain special characters, you would need to encode the output to avoid user interface mess-ups and cross-site scripting attacks. A straightforward MVC method would do the trick:

<%= Html.Encode(Model.CustomerName) %>

All these ways to encode output are not inconvenient, but a shorter syntax would be great. This is what the nifty new “code block” tag does:

<%= Model.CustomerName %>

Notice the colon (:) immediately after the opening tag. It is a new way to encode output. The old equal sign syntax (which itself is a shortcut for Response.Write) is not going away. You can continue to use the old way, but the colon-syntax encoding is there to make the view page syntax cleaner.

Note that at this writing, you cannot use ASP.NET MVC 2 RC within Visual Studio 2010 Beta 2. Thus, you cannot effectively use this combination to test these code block tags, but you can test them in regular ASP.NET 4.0 applications (or with the older MVC Beta 2).

Using lamda expressions with the HtmlHelper object

If you have used ASP.NET MVC 1.0, then you've most probably also created a model object and enabled editing of its details with HTML code similar to the following:

<%= Html.TextBox(“Name”, Model.Name) %>

Although this is fine for many purposes, the problem is that you still have to enter a string constant. Because it is a string, the compiler will not complain if you later change the property name in the model class, but forget to change the HTML tag. Also, the syntax is somewhat verbose (at least to some developers), and requires you to manually create one field per model object property.

In ASP.NET MVC 2, you can use the new TextBoxFor method. Just like the previous HtmlHelper methods like Label, ListBox, and so on, there are now multiple *For methods that all accept a lambda expression returning the correct object value.

Thus, to create a new editing control for the Name property, you could write code like this:

<%= Html.TextBoxFor(c => c.Name %>

Here, the lambda expression parameter "c" is replaced at runtime with the model object instance, and in addition to getting rid of the string value, you will get full IntelliSense support just like before with the model object.

ASP.NET MVC 2 also brings support for a convenient way to create editing forms for complex objects quickly. For instance, if you had a model object with three fields, you could either manually create labels and text boxes for each of the three fields, or use a new extension method called EditorForModel. This method will create form fields for each visible property in the model:

<%= Html.EditorForModel() %>

This method is really convenient, if you don't have special formatting requirements for your editing forms.

Top Reasons to host your ASP.NET MVC Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



IIS 7.5 European Hosting :: Installing Hyper-V on Windows Server 2008 Server Core

clock May 1, 2010 07:03 by author Scott

Are you looking for an affordable hosting service? Are you looking for good service at affordable prices? Try HostForLife.eu, only with € 3.00/month, you can get a reasonable price with best service. This topic contains only brief information about Windows Server 2008, if you want to be more familiar with Windows Server 2008, you should try HostForLife.eu.

The Server Core installation option of the Windows Server 2008 operating system installs a minimal server installation of Windows Server 2008 to run supported server roles, including the Hyper-V role. When you select the Server Core installation type option, the Windows setup program installs only the files that are required for the supported server roles. For example, the Explorer shell is not installed as part of a Server Core installation. Instead, you must configure the server locally using the command line.

The benefits of using the Hyper-V on a Server Core installation include a reduced attack surface, reduced management, and reduced maintenance.

After you have enabled the Hyper-V role on Server Core, you can manage the Hyper-V role and virtual machines remotely using the Hyper-V management tools. The management tools are available for Windows Server 2008 and Windows Vista Service Pack 1 (SP1).

BIOS Settings

You must enter the BIOS setup of the server and make sure that “Virtualization Technology” and “Execute Disable” are both set to Enabled.  In most cases, the required BIOS settings can be found in these BIOS sections (actual names may differ, based upon your server's BIOS settings):

- Security > Execute Disable (set to On)
- Performance > Virtualization (set to On)
- Performance > VT for Direct I/O Access (set to On)
- Performance > Trusted Execution (set to Off)

Operating System Version and Architecture

In case you were not the person that has initially installed the server, you'd better make sure it supports Hyper-V and that is has the appropriate license to operate it, before starting to install the role. To find out what kind of Windows Server product is currently installed, you to run the following command:

wmic OS get OperatingSystemSKU

The number that is returned corresponds with Microsoft's list of SKU numbers for Windows Server. Please ensure that your version supports Hyper-V:

- 12 - Windows Server 2008 Datacenter Edition, Server Core
- 13 - Windows Server 2008 Standard Edition, Server Core
- 14 - Windows Server 2008 Enterprise Edition, Server Core

If any other number is returned, this means that you should not install Hyper-V on this server.

You should also check the architecture of the server installation as well:

wmic OS get OSArchitecture

The architecture should be 64-bit in order to be able to install Hyper-V.

Installation procedure

Below is the step-by-step on installing Hyper-V on Windows Server 2008 Server Core:

1. Complete the Server Core installation and initial configuration tasks. These include the following tasks:

- Setting the administrative password – Use the NET USER command.
- Configuring the server's computer name – Use the NETDOM command.
- Setting a static IP address on all relevant NICs – Use the NETSH command.
- Activating the server – Use the SLMGR.VBS command.
- Joining the server to a domain (if required) – Use the NETDOM command.
- Configure the firewall for remote administration – Use the NETSH command.
- Enable Remote Desktop for Administration if you want to manage the server running a Server Core installation remotely – Use the SCREGEDIT.WSF command.

2. After you have installed Windows Server 2008, you must apply the Hyper-V update packages for Windows Server 2008 (KB950050). See download links above.

Download the Hyper-V updates, copy them either to the Server Core local hard disk or to a network share and then type the following command at a command prompt:

wusa.exe Windows6.0-KB950050-x64.msu /quiet

To view the list of software updates and check if any are missing, at the command prompt, type:

wmic qfe list

After you install the updates, you must restart the server.

Important note: Before you enable the Hyper-V role, ensure that you have enabled the required hardware-assisted virtualization and hardware-enforced Data Execution Prevention (DEP) BIOS settings. Checks for these settings are performed before you enable the Hyper-V role on a full installation, but not on a Server Core installation. If you enable the Hyper-V role without modifying the BIOS settings, the Windows hypervisor may not work as expected.

3. To install the Hyper-V role, at a command prompt, type:

start /w ocsetup Microsoft-Hyper-V

4. Add a user or group to the local Administrators group so that they can manage the Server Core installation remotely. To add a user to the local Administrators group, you must first add the user. At a command prompt, type:

net user <username> * /add

To add a user to the local Administrators group, at a command prompt, type:

net localgroup administrators /add <user>

5. Restart the server to make the changes take effect. At a command prompt, type:

shutdown /r /t 0

6. Use a regular installation of Windows Server 2008 or Windows Vista SP1 to remotely connect to the Server Core machine and manage the Hyper-V role on it.

Top Reasons to host your ISS 7.5 Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



Full Trust European Hosting :: How to Grant Full Trust to Your ASP.NET web site on your VPS or Dedicated Server

clock May 1, 2010 06:39 by author Scott

In our last post, we discussed topics about Full Trust and Windows Azure. Now, we’ll discuss how to grant Full Trust to your ASP.NET website on your VPS/Dedicated Server. However, in this article, we describe only briefly about Full Trust European Hosting. If you want to be more familiar with Full Trust European Hosting, we recommend you to try HostForLife.eu Only with € 3.00/month, you can get a reasonable price with best service. C’mon, Try it!!

Here we go...

On your Virtual Private Server or Dedicated server browse to the configuration folder

Normally installation path will be - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

Open the web.config in notepad

Place following lines at the top of you config with the <configuration> directive replacing yourdomain.com with the name of the IIS web you wish to grant full trust to.

<location path=”yourdomain.com” allowOverride=”true”>
<system.web>
<trust level=”Full” originUrl=”" />
</system.web>
</location>

Now your web.config will look like -

<?xml version=”1.0 encoding=”utf-8?>
<!– the root web configuration file –>
<configuration>
<!–
Using a location directive with a missing path attribute
scopes the configuration to the entire machine.  If used in
conjunction with allowOverride=”false”, it can be used to
prevent configuration from being altered on the machine

Administrators that want to restrict permissions granted to
web applications should change the default Trust level and ensure
that overrides are not allowed
–>
<location allowOverride=”true”>
<system.web>
<securityPolicy>
<trustLevel path=”yourdomain.com” name=”Full” policyFile=”internal” />
</securityPolicy>
<trust level=”Full” originUrl=”" />
</system.web>
</location>
<system.net>
<defaultProxy>
<proxy usesystemdefault=”true” />
</defaultProxy>
</system.net>

Top Reasons to host your FullTrust Website with HostForLife.eu

There are many reasons why so many people choose HostForLife over any other web hosting provider each year. Whether you’re beginner or an experience webmaster, HostForLife offers the perfect solution for everyone.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added-benefits you can find when hosting with us:

1. World-class 24x7 Customer Support
Will your hosting company promptly answer questions and resolve issues - at 3 am on a Sunday? Even some providers claiming “24x7” support will not - but HostForLife will. Our outstanding uptime is backed by true 24x7 customer support. An expertly trained technician will respond to your query within one hour, round the clock. You will also get qualified answers. Other hosting companies typically have very low - level support staff during the night or weekends. HostForLife always has knowledgeable, top - level  support standing by, day or night, to give you the answers you need.

2. Commitment to Outstanding Reliability
Reliability, Stability, and Performance of our servers remain out TOP priority. Even our basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. Our state-of-the-art data centers combine servers and SAN storage with full redundancy and operational tools with proprietary service management techniques. Full backup and recovery capabilities are implemented, including redundant power supplies, cooling and connectionsto major data networks.

3. “Right-size” plans for maximum value
HostForLife offers a complete menu of services. IT professionals select only what they need - and leave behind what they don’t. The result is an optimal blend of cost and performance. We offer IT professionals more advanced features and the latest technology - ahead of other hosting companies.

4. Profitable, Stable, Debt-free Business
Financial stability is the bedrock of a hosting provider’s ability to deliver outstanding uptime, cost-effective service plans and world-class 24x7 support.  HostForLife’s customers are assured of our financial integrity and stability - a stark contrast to the ups and downs they may have experienced with other providers.

5. The Best Account Management Tools
HostForLife revolutionized hosting with Plesk Control Panel, a Web-based interfaces that provides customers with 24x7 access to their server and site configuration tools. Some other hosting providers manually execute configuration requests, which can take days. Plesk completes requests in second. It is included free with each hosting account. Renowned for its comprehensive functionally - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLife’s customers.

6. 30-Day Money Back Guarantee
HostForLife 30 day money back guarantee ensures you have the ability to cancel your account anytime within your first 30 days under our full 30 day money back guarantee (less one-time account setup free). So what are you waiting for? Sign up today, risk free…

7. Simplicity with FREE 1-Click Installation
HostForLife was designed with ease of use in mind. From one click installations of your favourite website applications to our much talked about drag and drop website builder, you can rest assure your stay with us is going to be a smooth one. HostForLife offers the most extensive set of scripts on the web allowing you to build complicated websites with little or no programming knowledge at all. From blogs to forums to powerful e-commerce solutions, Super Green has something that is right for you.

 



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in