Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

Comparison of Windows ASP.NET Hosting between ASPHostPortal.com Hosting Platform and Windows Azure Platform

clock August 25, 2014 07:43 by author Kenny

In this article, we wrote the review about Windows Azure Vs Shared Hosting. In this session we choose ASPHostPortal as a challenger of Windows Azure. ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. While Windows Azure is Microsoft powered flexible Cloud service. It supports platforms such as Java, PHP& .NET. It is quite compatible with other Microsoft applications such as SharePoint, SQL server, & Microsoft Outlook.

ASPHostPortal offers the most bang for your buck: Just $5.00 per month, you get a Windows Server 2012 instance configured with 8GB RAM, 60GB of bandwidth and 5GB of storage. That price includes a generous support plan complete with 24/7 support from expert engineers, making it attractive for those who are completely new to hosted services.

Microsoft is currently offering a 30-day free trial of Azure. You receive a $200 credit to spend on Azure services during the trial. You can create and try out any combination of Azure resources you like. You will need to enter a credit card, though you won't bill during the period of the trial. One of the complaints sometimes leveled against Azure is its expense. You can spent more money for almost same service.

Check the service comparison between ASPHostPortal and Windows Azure below:

Provider

Spec

Price

Total

ASPHostPortal

5 GB Disk Space

$5.00/mo

$5.00/mo


60 GB Bandwidth


2 SQL Server


200 MB SQL Server / db


8 GB RAM or higher


Host Unlimited Sites

Windows Azure

20 GB Disk Space

$14.88/mo

$105.87/mo


60 GB Bandwidth

$6.60/mo


2 SQL Server

$9.99/mo


100 MB


1.6GHz CPU, 1.75GB RAM

$74.4/mo


500 Sites



SQL Server 2014 Hosting with ASPHostPortal.com :: How to Restart an Interrupted SQL Server Database Restore

clock August 23, 2014 09:53 by author Kenny

SQL Server is Microsoft's relational database management system (RDBMS). It is a full-featured databse primarily designed to compete against competitors Oracle Database (DB) and MySQL.

Like all major RBDMS, SQL Server supports ANSI SQL, the standard SQL language. However, SQL Server also contains T-SQL, its own SQL implemention. SQL Server Management Studio (SSMS) (previously known as Enterprise Manager) is SQL Server’s main interface tool, and it supports 32-bit and 64-bit environments.

In this article, we will tell you about how to restart an interrupted SQL Server Database Restore.
Have you ever restored a large database on a Failover Cluster Production Server and while the restore was in progress, due to network failure, the restore failed? Once the SQL Server came up on the other node all the databases came up, except for the database which you were restoring prior to the failover. In this tip we will take a look at the command RESTORE DATABASE...WITH RESTART to see how this command can be helpful during such scenarios.

Here is the solution

The RESTORE DATABASE...WITH RESTART command is a very useful command which is available in SQL Server 2005 and higher versions. A Database Administrator can use this command to finish restoring an interrupted database restore operation.

In the below snippet you can see that ProductDB is in a (Restoring...) state once the SQL Server came online after the unexpected failure.

During such scenarios one can execute the RESTORE DATABASE...WITH RESTART command to successfully complete the database restore operation.

Below are two commands.  The first gets a list of the backups on the file and the second does the actual restore with the restart option.

-- get backup information from backup file
RESTORE FILELISTONLY
FROM DISK ='C:\DBBackups\ProductDB.bak'
GO

-- restore the database
RESTORE DATABASE ProductDB
FROM DISK ='C:\DBBackups\ProductDB.bak'
WITH RESTART
GO

Below you can see that after running the RESTORE DATABASE...WITH RESTART command the database was successfully restored allowing user connectivity.



Windows Server 2012 R2 Hosting with ASPHostPortal.com :: How to Reset Windows Server 2012 R2 Lost Admin Password Easily

clock August 6, 2014 06:28 by author Kenny

Windows Server 2012 R2 brings a host of new features that greatly enhance the functionality of the operating system. Many of these improvements expand on existing capabilities of Windows Server 2012.  The new product also benefits from having the capability of performing at a much higher level than previous servers and comes equipped with an integrated virtualization platform.

In this article I will tell you about how to reset Windows Server 2012 R2 lost admin password. The answer is not absolute. For example, if you have password reset disk or another administrator available, Windows server 2012 r2 lost admin password would be reset instantly.
Or if you have backup Windows system status with disk, such as Windows system restore disc, you could restore Windows server 2012 r2 to early system point.

Even though there are not anything available for recovering server 2012 r2 password, Windows system 2012 r2 installation disk and third-party recovery tool would help you too.

First, Windows system installation disk reset Windows server 2012 r2 admin password.

Preparation: a copy of Windows server 2012 r2 installation disk

The key step of resetting server 2012 r2 admin password with installation disk is to replace Utilman.exe.

  1. Boot off Windows disk and select the "Repair your computer" option from the lower left-hand corner.
  2. Get to the option to open the Command Prompt.
  3. Type the following commands to back up the utilman.exe file:
    MOVE C:WindowsSystem32Utilman.exe C:WindowsSystem32Utilman.exe.bak
  4. Copy cmd.exe and rename it Utilman.exe.
    COPY C:WindowsSystem32cmd.exe C:WindowsSystem32Utilman.exe

    Now you can go ahead and reboot your machine. When it's done booting up again and you are at the Logon screen click on the Ease of access icon.

    Now you have replaced Utilman.exe with cmd.exe.
  5. Command Prompt opens, type following commands:
    .net user administrator *

Once you press Enter, you will be asked to set a new password and then confirm it. When entering new one, don't worry if you can't see it, because it is invisible, however it has been remembered.
Once you're logged in again, don't forget to delete Utilman.exe and then rename Utilman.exe.bak back to plain old Utilman.exe.

Second, reset server 2012 r2 admin password with third-party Windows password genius.

Windows Password Genius has four versions available, standard, professional, and advanced and raid. And the raid version is special, because it works for raid server Windows domain or local admin password reset. The advanced is general version, working on both server and client computers.

So choose appropriate Windows password recovery version to burn a password reset disk and then recover Windows server administrator password.

Preparation: Windows Password Genius Advanced/Raid, available computer and bootable USB drive.

  1. Install Windows Password Genius Raid, and run it on available computer.
  2. Insert bootable USB drive into this available computer and choose USB, click "Begin burning" to create password reset disk with USB.
  3. Exit USB device after it is successfully burned with password reset disk.
  4. Plug USB into server 2012 r2 and boot server from USB.
  5. Recovery tool program runs, and then choose Windows system - Windows serve 2012 r2, and select user account - administrator.
  6. Click "Reset Password", the administrator would be set with new password "[email protected]".
  7. At last, reboot server computer to finish Windows password reset. But remember to exit USB reset disk from server before your server computer boots from hard disk successfully.


Windows WebSocket Hosting with ASPHostPortal.com :: Simple WebSocket Application

clock July 22, 2014 11:02 by author Kenny

In this article I will explain about Simple WebSocket Application. In order to a create a working application, you also need a server side implementation. It’s possible to use technologies like node.js, Java, .NET, Ruby, or C++ to create server side implementation. This section will show you how to create a simple application using WebSockets.

The sample application will allow the user to ask specific questions to server. The server side implementation is done using the Java jWebSocket framework on Windows 7. So, to get the environment set up follow these simple steps. I assume you have already installed the latest JDK (JDK 7)on your Windows 7 PC.

Step 1

Head over to jWebSocket Downloads and download the first zip which is marked as server.

Step 2

Unzip the archive, and place it somewhere in your C:. Then, create a new environment variable named JWEBSOCKET_HOME, which references the root of your jWebSocket installation. This is the path to the jWebSocket-1.0 folder. Add the following JARs to your class path:

JWEBSOCKET_HOME/libs/jWebSocketServer-1.0.jar
JWEBSOCKET_HOME/libs/jWebSocketServerAPI-1.0.jar
JWEBSOCKET_HOME/libs/jWebSocketCommon-1.0.jar

Step 3

Create a new Java Source file and name it SocketListener.java. Add the following code to this file.

import java.util.Date;
import java.text.SimpleDateFormat;
import org.jwebsocket.factory.JWebSocketFactory;
import org.jwebsocket.server.TokenServer;
import org.jwebsocket.kit.WebSocketServerEvent;
import org.jwebsocket.api.WebSocketServerListener;
import org.jwebsocket.api.WebSocketPacket;
import org.jwebsocket.config.JWebSocketConfig;
import org.jwebsocket.instance.JWebSocketInstance;
class JWebSocketListener implements WebSocketServerListener
{
  public void processOpened(WebSocketServerEvent event)
  {
    System.out.println("Connection Opened");
  }
  public void processPacket(WebSocketServerEvent event, WebSocketPacket packet)
  {
    switch(packet.getString())
    {
      case "1":        packet.setString("My Name is jWebSocketServer");
        break;
      case "2":        packet.setString("Windows 7 64 Bit");
        break;
      case "3":        SimpleDateFormat sdf=new SimpleDateFormat("hh:mm:ss");
        packet.setString(sdf.format(new Date()));
        break;
    }
    event.sendPacket(packet);
  }
  public void processClosed(WebSocketServerEvent event)
}
public class SocketListener
{
  public static void main(String[] args)
{
    JWebSocketFactory.printCopyrightToConsole();
    JWebSocketConfig.initForConsoleApp(new String[]{});
    JWebSocketFactory.start();
    TokenServer server = (TokenServer)JWebSocketFactory.getServer("ts0");
    if(server!=null) {      server.addListener(new JWebSocketListener());
    }
    while (JWebSocketInstance.getStatus() != JWebSocketInstance.SHUTTING_DOWN)
{
      try {
        Thread.sleep(250);
      }
      catch (InterruptedException e)
    }
  }
}

Explanation

The code implements the WebSocketServerListener interface. The interface declares the following three methods which should be implemented in our class, JWebSocketListener.

processOpened()
processPacket()
processClosed()

processOpened() is called once a connection is opened. An example use of this will be starting a thread that sends updates to client in regular intervals. Similarly, processClosed() is called when the connection closes so that you can perform any clean ups.

In our application, the major processing is done in processPacket(). This method is called whenever the browser sends a message to the server. It receives two objects, of types WebSocketServerEvent and WebSocketPacket. First, we use WebSocketPacket#getString() to read the message (which is a question asked by the client). Depending on the question the server sends an answer. The message to be sent is wrapped inside a WebSocketPacket using WebSocketPacket#setString(). Then, we call WebSocketServerEvent#sendPacket(), passing the packet as an argument. Next, we create a public class called SocketListener. This class starts a WebSocket implementation server and registers our custom listener to it.

Step 4

Compile SocketListener.java, and start your server using the command java SocketListener.

Step 5

Now that you have done the server side implementation, it’s time to create the client that will interact with the server. The following is our initial HTML markup:

<html>
  <head>
    <title>WebSocket Test</title>
    <style>      #response
{
        width: 200px;
        background: #F2F2F2;
        padding: 120px 0px 120px 0px;
        font-size:18px;
      }
    </style>
  </head>
  <body>
    <div align="center">
      Choose a question to ask:
      <select id="question" name="question" onchange="sendMessage(this.value);">
        <option value="1">What's Your Name</option>
        <option value="2">Which OS You Are Running On?</option>
        <option value="3">What Time Is It?</option>
      </select>
      <br/>
      <br/>
      <div id="response">
        My Name is jWebSocketServer
      </div>
    </div>
  </body>
</html>
Now, add the following JavaScript to the HTML:
<script type="text/javascript">
var connection = new WebSocket('ws://localhost:8787', 'json');
connection.onopen = function ()
{
  console.log('Connection Opened');};connection.onerror = function (error)
{
  console.log('WebSocket Error ' + error);};
connection.onmessage = function (e) {
  if(e.data.indexOf("subProtocol")==-1)    document.getElementById("response").innerHTML=e.data+"<br/>";};
function sendMessage(msg){  connection.send(msg);}
</script>

Explanation

We created an HTML file that allows users to choose questions from a drop down menu. When an onchange event fires, we take the value of the selected item and send that value to the server. The server then processes the request and sends back an answer to the browser. When the message from the server is received, the onmessage callback is executed, which shows the response in the response <div>. The line if(e.data.indexOf("subProtocol")==-1) is not mandatory. I have included it because initially when the connection is opened, the server sends a long string containing information to the browser. As we don’t want to show this string, I have included the above condition.



SQL Server 2014 Hosting with ASPHostPortal.com :: New Feature in SQL Server 2014 - Business Intelligence

clock June 16, 2014 07:24 by author Kenny

Business Intelligence - New Feature of SQL Server 2014

SQL Server 2014 includes business intelligence (BI) improvements to help build and support vast databases and data warehouses.

Microsoft has been pouring R&D resourcesinto building out its business intelligence (BI) feature set and the upcoming SQL Server 2014 (SQL2014) release will continue that trend. The new release includes enhancements to make data exploration easier, improvements in BI semantic modeling, new offerings to help build and support massive databases and data warehouses, and tools to ensure the quality and consistency of data. Here’s what SQL2014 will do for you with regards to business intelligence:

BI Semantic Model in SQL Server 2014

Microsoft’s improvements in their BI Semantic Modeling (BISM) enables users new ways to build out BI solutions the scale from small, single-person usage to huge Fortune 500 organizations, focusing on credible and consistent data.

Data Exploration Enhancements in SQL Server 2014

Microsoft has more than 300 million users who think of Excel when they think about manipulating data. It only makes sense to reinforce the relationship between Excel and to a wider extent Microsoft Office, as a front end for data manipulation, exploration, and visualization against a SQL Server back end all through the rich and familiar front end of Excel. Microsoft’s new PowerPivot add-in for Excel makes accessing and analyzing data very easy for end users. The new Power View browser-based add-in for Excel adds new, powerful means of visualizing data, wherever it resides. Other new tools include Power Map (formerly known as Project GeoFlow) and Project Data Explorer, for better mapping and geographic data integration and data import into Excel for heterogeneous data sources, respectively.

Enterprise Information Management (EIM)

Enterprises need help controlling the spread of data silos and ensuring the quality and consistency of data. Microsoft has introduced or enhanced several tools to serve this requirement. The Data Quality Services (DQS) tools help enterprises and data stewards manage end-to-end data management by building a knowledge base of data-quality topics. Master Data Services (MDS) adds new features, such as an MDS add-in for Excel, to map objects, reference data, and control dimensions and hierarchies of data.

Big Data

Big data gets even easier in SQL2014. There are lots of new offerings to help build and support massive databases and data warehouses, such as scaling up to 15k partitions in a data store and up to 640 logical cores on high-end database servers. In addition, Microsoft has fully embraced Hadoop in the form of HDInsight, on Windows Azure and Windows Server, to take advantage of unstructured data and the parallel computational approach common to Hadoop applications. PolyBase, also new in SQL2014, is a feature of the SQL Server Parallel Data Warehouse (PDW) which makes combining nonrelational data and traditional relation data an easy and swift process.

Microsoft has just announced new integrated BI functionality for Office 365 Power BI for Office 365. Previous add-on options Data Explorer and Geoflow have been integrated into the BI Suite and have been renamed as Power Query (Data Explorer) and Power Map (Geoflow). Power Query enables users to pull in information from the web or external sources and merge it with local data, providing for an easier method for enriching your internal data. Power Map provides enhanced mapping capabilities and the ability to interact with any geographic data you may have.



SQL Server 2014 Hosting with ASPHostPortal.com :: Important New Features in SQL Server 2014

clock June 11, 2014 11:19 by author Kenny

Good news, Microsoft release SQL Server 2014 recently. SQL Server 2014 has several compelling new features that can definitely justify an upgrade. For OLTP, the most exciting new feature in SQL Server 2014 is In-Memory OLTP (aka "Hekaton"), which allows you to move individual tables to special in-memory structures. The performance boost can be as huge as 30x.

New In-Memory OLTP Engine

SQL Server 2014 enables memory optimization of selected tables and stored procedures. The In-Memory OLTP engine is designed for high concurrency and uses a new optimistic concurrency control mechanism to eliminate locking delays. Microsoft states that customers can expect performance to be up to 20 times better than with SQL Server 2012 when using this new feature.

Enhanced Windows Server 2012 Integration

SQL Server 2014 provides improved integration with Windows Server 2012 R2 and Windows Server 2012. SQL Server 2014 will have the ability to scale up to 640 logical processors and 4TB of memory in a physical environment. It can scale up to 64 virtual processors and 1TB of memory when running on a virtual machine (VM).

SQL Server 2014 also integrates with several new and improved features in Windows Server 2012 R2 and Windows Server 2012. For example, SQL Server 2014 supports the OSs' new Storage Spaces feature. With Storage Spaces, you can create pools of tiered storage to improve application availability and performance. In addition, SQL Server 2014 can take advantage of the OSs' Server Message Block (SMB) 3.0 enhancements to achieve high-performance database storage on Windows Server 2012 R2 and Windows Server 2012 file shares. Many enhancements were made to SMB 3.0, with the most notable being SMB Transparent Failover and SMB Direct. The new SMB Transparent Failover feature provides highly reliable SMB storage that's fully supported for applications like SQL Server and Hyper-V. With the new SMB Direct feature, you can leverage the NIC's Remote Direct Memory Access (RDMA) feature to provide access speeds for SMB file shares nearing the access speed for local resources.

Enhancements to AlwaysOn Availability Groups

AlwaysOn Availability Groups provides an effective solution for high availability for SQL Server 2012 / 2014 in on-premises deployments as well as for Windows Azure VM deployments. SQL Server 2014 also contains multiple enhancements for AlwaysOn Availability Groups. The maximum number of secondary replicas is increased from 4 to 8. When disconnected from the primary replica or during cluster quorum loss, readable secondary replicas now remain available for read workloads. There are also additional supportability enhancements.  Note that another enhancement is the Add Azure Replica Wizard. This will not be covered, since it requires VPN hardware etc. that is currently not easily available.

Updateable Columnstore Indexes

Things are changing now with SQL Server 2014, because Microsoft has resolved the above mentioned issues – with some magic and illusion: SQL Server 2014 provides you an Updateable Clustered ColumnStore Index! Let’s have a more detailed look on how this magic and illusion happens internally in SQL Server.
The first most important fact is that an underlying direct update of a ColumnStore Index is not possible! It would be too time consuming to do the complete decompress and compress on the fly during your INSERT, UPDATE, and DELETE transactions. Therefore SQL Server 2014 uses help from some magic: Delta Stores and Delete Bitmaps. Let’s have a more detailed look on both concepts.

SQL Server Data Tools for Business Intelligence

The BI aspects of SQL Server have also been improved. Data Tools for Business Intelligence are used to create SQL Server Analysis Services (SSAS) models, SQL Server Reporting Services (SSRS) reports, and SQL Server Integration Services (SSIS) packages. SSDT BI is based on Microsoft Visual Studio 2012. The database also supports Power BI for Office 365, with Power Pivot and Power View for data analysis and visualization.

Power View has been extended to provide support for multidimensional models, and for queries written using Data Analysis Expressions (DAX). A new Excel add-in, Power Query, lets you integrate data into Excel, and Power Map provides 3D mapping.

Why Should Upgrade?

Upgrading to a new release is usually a difficult decision for most organizations. However, SQL Server 2014's new In-Memory OLTP engine, with its promise of significantly improved application performance, offers a very compelling reason to upgrade for customers using SQL Server to support OLTP applications. One great way to find out the type of performance improvement that you might get out of SQL Server 2014's In-Memory OLTP capability is to download and install the SQL Server 2014 Evolution Edition and use the AMR tool to analyze your production workload. The AMR tool supports collecting data on SQL Server 2008 and later instances. This will give you a good idea of the type of performance improvements that you might expect to get using the new In-Memory OLTP engine as well as the changes that you might need to make to implement it. SQL Server 2014's In-Memory OLTP support promises to boost your database application performance to the next level



SQL Server 2014 Hosting witrh ASPHostPortal :: New Feature of SQL Server 2014 - SSD Buffer Pool Extension

clock June 11, 2014 07:54 by author Kenny

In this article I'm going to talk about one of the new feature of SQL Server 2014. As you know SQL Server 2014 contains some interesting new features. Although SQL Server Standard Edition is limited to 128GB of memory, teams deploying on Standard Edition have an option to fit more of their working set in low latency storage Buffer Pool Extensions that are introduced with SQL Server 2014. Well, the Buffer Pool is one of the main memory consumers in SQL Server. When you read data from your storage, the data is cached in the Buffer Pool. SQL Server caches Execution Plans in the Plan Cache, which is also part of the Buffer Pool. The more physical memory you have, the larger your Buffer Pool will be (configured through the Max Server Memory setting).

sql server 2014 with asphostportal.com

Creating a buffer pool extension for SQL Server 2014 is like being able to define a different page file in Windows. As data pages move into memory, they begin to fill up the buffer pool. If the buffer pool fills up, the less frequently used pages will be paged to disk. Then when they're needed again, they'll be swapped with something else in the buffer pool and moved back into memory. The buffer pool extension option allows you to define an SSD as a buffer file location. Because SSD is so much faster than spinning disk, the paging is considerably quicker, which increases performance dramatically in some cases. You can define a buffer pool extension file up to 32 times the size of your memory.

Prior to SQL Server 2014, the management of data and index pages in the buffer pool was handled by the buffer manager. This has not changed with the release of SQL Server 2014, a change in the architecture has allowed for creation of a hybrid buffer pool. The hybrid buffer pool now consists of the existing buffer pool plus an extension that resides on nonvolatile storage or an SSD. The buffer manager still deals with identifying those pages in the buffer pool that can be expunged, when required pages for a request are not residing in memory but on disk. This practice is still handled and undertaken by the buffer manager. In addition to the buffer manager deciding on which pages should be in the buffer pool or not, it is now identifying those pages which are considered as “clean pages” and migrating those pages out of the buffer pool onto the BPE to allow for even more data to reside in the buffer pool. This practice is providing the following benefits to your SQL Server environment (as stated in the Microsoft BPE article):

  • Increased random I/O throughput
  • Reduced I/O latency
  • Increased transactional throughput
  • Improved read performance with a larger hybrid buffer pool
  • A caching architecture that can take advantage of present and future low-cost memory drives


Plesk 12 on Windows Hosting with ASPHostPortal.com :: WordPress Toolkit in Parallel Plesk 12

clock June 4, 2014 11:49 by author Kenny

WordPress Toolkit in Parallel Plesk 12 has been released recently. Many advantages that very useful in the new WordPress Toolkit in Parallel Plesk 12. You can feel the big difference things when you try to use WordPress Toolkit in Parallel Plesk 12.

Why we must talking about WordPress? Yeah, because there are over 77.2 million WordPress sites worldwide. Because WordPress dominates the CMS industry with over 60% market share. WordPress is open source and extremely popular (it's making it a prime target for malicious hackers). Many Hosters have more orphaned & insecure WordPress installations running on their network than they have WordPress installations that secure & up-to-date. The WordPress Toolkit is designed to help Hosters Toolkit is designed to help Hosters manage the growing use of WordPress on their network. And many more topics for talking about this popular CMS.

Now WordPress and the latest Parallel Plesk 12 launches WordPress Toolkit. WordPress Toolkit in Parallel Plesk 12 has many benefits like:

  • Detect rogue & out-of-date WordPress installations on your server before they get hacked
  • Easily update/upgrade/harden any WordPress installation on any site
  • Get notified when new plugin & theme updates are available

Good news for Hosters, WordPress Toolkit is included in the Plesk 12 Web Host & Web Pro Editions. The first for Hosters is The Web Host Edition, it is perfect for Shared Hosters who often don’t manage what their customers can install. The WordPress Toolkit was designed to help their support staff detect, update, & harden WordPress installations across all sites on their server(s). And for Pro there is The Web Pro Edition, it is perfect for Agencies & Web Pros who mostly manage WordPress installations for their customers. You’re now equipping them with the key tool they need to more efficiently manage and secure their customers’ WordPress sites!

Parallel Plesk 12 is a lot better that the previous version. It has responsive UI for account management on any mobile device, new WordPress mass-management & security tools and improved server-to-site security out-of-the-box.

So, are you feel that the new WordPress Toolkit in Parallel Plesk 12 good? It is good idea for try the new innovation that makes you will be better.



WCF Hosting with ASPHostPortal.com :: How to Secure WCF Service on IIS

clock May 21, 2014 13:24 by author Kenny

In this article i will explain about how to secure WCF Service on IIS. That is typically an easy requirement but I had a couple of restrictions:

- Only BasicHttpBinding could be used on the client-side
- Client credentials (username / password) must be sent and validated with each request


Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application. An endpoint can be a client of a service that requests data from a service endpoint. The messages can be as simple as a single character or word sent as XML, or as complex as a stream of binary data.

One option is to send and validate the credentials as parameters to each method. This method is usually seen as unacceptable because credentials are passed across the service as plain-text. Do you want your password sent over a web service as plain-text?

After doing some research, I came up with a solution that is largely a combination of two sources: configuring a WCF service on IIS with SSL and username authentication over BasicHttpBinding… I’ll do my best to consolidate both of those sources for simplicity.

Programming / Configuring the WCF Service
1. Open Visual Studio.
2. Create a new ‘WCF Service Application’ project.
3. Define a service interface:

using System.ServiceModel;
namespace Brett.Service
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string GetData(int value);
    }
}


4. Implement your service interface. Our  GetData method will return a string that shows the authenticated username and the integer value passed. If the current identity is not authenticated, we throw an exception (this is not our validation method, that is shown shortly):
using System;
using System.ServiceModel;
namespace Brett.Service
{
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("{0} entered: {1}", GetCurrentUserName(), value);
        }
        private string GetCurrentUserName()
        {
            var primaryIdentity = ServiceSecurityContext.Current.PrimaryIdentity;
            if (primaryIdentity.IsAuthenticated)
            {
                return primaryIdentity.Name;
            }
            else
            {
                throw new Exception(@"User is not authenticated...");
            }
        }
    }
}

5. Implement a custom credential validator. The class needs to extend the abstract class UserNamePasswordValidator . The important implementation detail here is that you want to throw a FaultException  if the credentials are incorrect:
using System.IdentityModel.Selectors;
using System.ServiceModel;
namespace Brett.Service
{
    public class CustomValidator : UserNamePasswordValidator
    {
        public override void Validate(string userName, string password)
        {
            if (userName != @"hello")
            {
                throw new FaultException(@"User name must be 'hello'.");
            }
        }
    }
}


6. Edit your web config file. This is probably the most tedious portion of the process. I’ll go ahead and attach the whole file here:
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="Brett.Service.Service1"
               behaviorConfiguration="Brett_Behavior">
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="Brett_BindingConfiguration"
                  contract="Brett.Service.IService1" />
        <endpoint address="mex"
                  binding="mexHttpsBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="Brett_BindingConfiguration">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Brett_Behavior">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
                                    customUserNamePasswordValidatorType="Brett.Service.CustomValidator,
Brett.Service"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>


Some important things to note here… We expose two endpoints – one for the BasicHttpBinding and one for service metadata (mex). We are using BasicHttpBinding  withTransportWithMessageCredential  security (that further specifies a message credential type ofUserName ). The service credentials point to our CustomValidator . This is the absolute minimum needed for me to get the web service working – all elements were needed.

7. Publish the project somewhere local on your machine (right-click project, publish).

Configuring IIS for WCF Service with SSL
1. Follow instructions in this guide, until you reach ‘Configure WCF Service for HTTP Transport Security’ (don’t do that part). I would list these out myself, but I think the visuals provided in the link are very helpful.
2. I ended up having some file access issues with my application pool, so I ended up making my application pool run as an administrator identity.

Programming / Configuring the WCF Client
1. Open Visual Studio.
2. Create a new ‘Windows Console Application’ project.
3. Add a new service reference – use the location of your WCF Service that is hosted with IIS. The metadata for the service has been downloaded and an app.config file has been produced. We won’t use the app.config.

Program the console application to make a call to the service:
using Brett.Client.ServiceReference1;
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
namespace Brett.Client
{
    class Program
    {
        static void Main(string[] args)
        {
            var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
            var endpointAddress = new
EndpointAddress(@"https://localhost/WhateverYouNamedThis/Service1.svc");
            using (var service = new Service1Client(binding, endpointAddress))
            {
                var loginCredentials = new ClientCredentials();
                loginCredentials.UserName.UserName = @"hello";
                loginCredentials.UserName.Password = @"brett's password";
                var defaultCredentials = service.Endpoint.Behaviors.Find<ClientCredentials>();
                service.Endpoint.Behaviors.Remove(defaultCredentials); //remove default ones
                service.Endpoint.Behaviors.Add(loginCredentials); //add required ones
                var data = service.GetData(100);
                Console.WriteLine(data);
                Console.ReadLine();
            }
        }
    }
}



ASPHostPortal.com Proudly Announces Cheap Windows Cloud Server Hosting

clock May 5, 2014 13:26 by author Kenny

-- Highly affordable Windows Cloud Server, Provisioned in just 5-10 minutes Start from $18.00/month! --

ASPHostPortal.com, a leading Windows web hosting provider, proudly announces the most affordable Windows Dedicated Cloud Server. With Windows Dedicated Cloud Server Services from ASPHostPortal.com, you’ll find the perfect Cloud Server solution for your business. Web pages will load faster for ecommerce customers, databases will get higher IOPS and applications streaming large volumes of video and media files will experience low latency when customers run their applications. With cloud servers, you have the ability to upgrade and downgrade your servers on the fly. In some cases depending on the Operating System running on the cloud server it may still require a reboot. Migrating your cloud server to a different physical server can usually be accomplished with no downtime via hot migration.

ASPHostPortal.com offer Windows Dedicated Cloud Server with the following features:

  • Windows 2008R2/2012
  • Data Center OS Version
  • 1 x vCPU
  • 1 GB RAM
  • 40 GB Storage (SSD)
  • 1000 GB Bandwidth
  • 1000 Mbps Connection
  • 1 Static IP
  • SAN Storage

"An scalable and flexible cloud servers account costs $18.00 per month and gives you 40 GB Storage (SSD), SSD might make the server boot faster, it is now up to 100 times faster than a hard drive" said Dean Thomas, Manager at ASPHostPortal.com.

Cloud hosting systems are run on systems with very powerful processors with SAN Storage which is typically faster for most applications.  A storage area network can be easier to manage than other storage systems. By consolidating information into one easily accessible place, it becomes easier to access information while also making it simple to increase capacity as and when required.


Windows Cloud server probably holds the best stability / cost ratio performance. They do not suffer from the usual server hardware problems and they have all Cloud computing, benefits, i.e. they are stable, fast and secure.

Where to look for the best Windows cloud server service? How to know more about the different types of hosting services? Read more about it on http://www.asphostportal.com.

About ASPHostPortal.com:

ASPHostPortal.com is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and SharePoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, ASPHostPortal.com strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

 photo ahp banner aspnet-01_zps87l92lcl.png

Author Link

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in