ASP.NET 4.0 Hosting & ASP.NET 4.5 Hosting BLOG

BLOG about ASP.NET 4.5 Hosting, ASP.NET 4.0 Hosting and .NET 4.5 Framework and its Capabilities

URL Rewrite Hosting with ASPHostCentral.com

clock June 13, 2010 06:53 by author Administrator

IIS URL Rewrite 2.0 enables Web administrators to create powerful rules to implement URLs that are easier for users to remember and easier for search engines to find. By using rule templates, rewrite maps, .NET providers, and other functionality integrated into IIS Manager, Web administrators can easily set up rules to define URL rewriting behavior based on HTTP headers, HTTP response or request headers, IIS server variables, and even complex programmatic rules. In addition, Web administrators can perform redirects, send custom responses, or stop HTTP requests based on the logic expressed in the rewrite rules.


Define powerful rules to transform complex URLs into simple and consistent Web addresses


URL Rewrite allows Web administrators to easily build powerful rules using rewrite providers written in .NET, regular expression pattern matching, and wildcard mapping to examine information in both URLs and other HTTP headers and IIS server variables. Rules can be written to generate URLs that can be easier for users to remember, simple for search engines to index, and allow URLs to follow a consistent and canonical host name format. URL Rewrite further simplifies the rule creation process with support for content rewriting, rule templates, rewrite maps, rule validation, and import of existing mod_rewrite rules.


Easily replace Web application URLs to produce user and search engine friendly results

URL Rewrite permits Web administrators to easily replace the URLs generated by a Web application in the response HTML with a more user friendly and search engine friendly equivalent. Links can be modified in the HTML markup generated by a Web application behind a reverse proxy. URL Rewrite makes things easier for outbound response content and headers rewriting with outbound rewrite rules that work with HTTP request and response headers and with IIS server variables


Seamless integration with existing IIS features that improve management, performance, and troubleshooting

URL Rewrite is tightly integrated with IIS Manager for better management. In addition, URL Rewrite supports both user-mode and kernel-mode caching for faster performance. URL Rewrite also supports Failed Request Tracing for enhanced troubleshooting of application logic execution


Features of URL Rewrite 2.0

- Rules-based URL rewriting engine
- Rules-based response rewriting engine
- Support for custom .NET rewrite providers
- Regular expression pattern matching
- Wildcard pattern matching
- Global and distributed rewrite rules
- Rewriting within the content of specific HTML tags
- Pre-conditions for outbound rules
- Access to server variables and HTTP headers
- Rewriting of server variables and HTTP request headers
- Rewriting of HTTP response headers
- Allow list for server variables
- HtmlEncode function
- Built-in rule templates
- Reverse proxy rule template
- Rule templates for Search Engine Optimization
- Various rule actions including redirect and request abort
- Tracking capture groups across rule conditions
- Logging of rewritten URLs
- Updated user interface in IIS Manager
- Integrated user interface for managing rewrite rules and rewrite maps
- Integrated user interface for importing of Apache mod_rewrite rules
- Integrated user interface for testing regular expression and wildcard patterns
- Support for IIS kernel-mode and user-mode output caching
- Lowercase conversion function
- Rewrite maps to generate the substitution URL during rewriting
- Failed Request Tracing support


Reasons to trust your URL Rewrite website to us

 What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in URL Rewrite Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it.
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications
directly via our Control Panel in 1 minute!



VS 2010 Hosting :: Preparing a Host server for VS2010 web publishing

clock June 10, 2010 06:55 by author Administrator

Visual Studio 2010 (VS2010) has some wonderfully integrated features for building and deploying web sites. The VS team has finally made it easy to get your web site onto someone else's Host server. But what if you want to implement a Host server and allow developers/customers easy access to your server? How do you do it?  You have questions, we have answers.

ASPHostCentral.com offers the Visual Studio 2010 hosting to all our new customers. You can always start from our Standard Plan hosting plan (from @$4.99/month) to get this start using the Visual Studio 2010 service. Should your requirement changes in the future, you can always request for an upgrade without causing any downtime. Remember, everything is just one-click away from your mouse! So, why wait longer? Please register your interest here


In Visual Studio 2010 (and in VS2008 as a separate download), the web developer can quickly deploy the website by using the Publish Web  feature. To publish a web, generally the developer would create a Configuration, add in the proper web.config transforms for his server-specific settings, right-click on the web project, and select Publish. The resulting dialog looks something like the one presented below. But what does the server need to support in order to allow web publishing from Visual Studio? 


Enter the Web Deploy Tool

To accept web publishing your server must be running IIS and have installed the Web Deploy tool 1.1 or later. The Web Deploy tool is supported on both 32-bit and 64-bit servers and is pretty simple to install.
1. If you haven't done so already, install the
Microsoft Web  Platform installer. This application makes installing IIS modules (like the Web Deploy tool) a snap!
2. Install the Web Deploy tool appropriate for your server (32-bit or 64-bit).
3. More installation instructions can be found here
4. Once installed the only "gotcha" that you may hit is that the Web Deployment Agent Service is not immediately started. To start this service Please do the following:
    - On the server, click Start |
Run
    -
Type in services and hit
enter
    -
Search for
Web Deployment Agent Service
    - Right-click
on the service and select
Properties
    -
Change the Start-up Type to Automatic (or Automatic delayed start)
    - Click the Start button on the dialog to start the service immediately
    - Click OK to save your changes


Configuring a Website for Publishing

In order to allow a user to publish to a website, a couple items need configuration. This includes setting up the website and the user(s) that will be allowed to publish to the site


Setting up the website

Setting up the website in IIS7 works the exact same way as normal. Run IIS Manager and create a new website. As always, make sure the Application Pool account has access rights to the website directory


Setting up the users

The next step involves making sure the users have access to the website directory.  The user accounts are Windows accounts, and they will need read/write privileges to the actual website directory. In windows explorer, navigate to the website directory and make sure the appropriate users have permissions


Publishing to the Server

Once the website is setup and the users have been given permission, you are now ready to Publish to your website
1. To publish, run VS2010, right-click the web project in Solution Explorer, and select the Publish menu option
2. From this dialog, you will want to pick the Web Deploy publish method
3. The Service URL will be the default website URL for your server
4. The site/application value is simply the name of your website as seen in IIS manager
5. Make sure  you enter the user name/password of the user account on the host server that has permissions to publish to the site


Reasons to trust your Visual Studio 2010 website to us


 What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in VS 2010 Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it.
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install
more than 100 FREE applications
directly via our Control Panel in 1 minute!




ASP.NET 4 Hosting :: Error Message - A potentially dangerous Request.QueryString value was detected from the client

clock May 26, 2010 07:53 by author Administrator

For those of you who just upgraded your site to the latest ASP.NET 4.0 Framework, you may sometimes see this error message: “A potentially dangerous Request.QueryString value was detected from the client”.

The request validation feature in ASP.NET provides a certain level of default protection against cross-site scripting (XSS) attacks. In previous versions of ASP.NET, request validation was enabled by default. However, it applied only to ASP.NET and only when those pages were executing.

In ASP.NET 4, by default, request validation is enabled for all requests, because it is enabled before the BeginRequest phase of an HTTP request. As a result, request validation applies to requests for all ASP.NET resources, not just .aspx page requests. This includes requests such as Web service calls and custom HTTP handlers. Request validation is also active when custom HTTP modules are reading the contents of an HTTP request.

As a result, request validation errors might now occur for requests that previously did not trigger errors. To revert to the behavior of the ASP.NET 2.0 request validation feature, add the following setting in the Web.Config  file:

<httpRuntime requestValidationMode="2.0" />

However, we recommend that you analyze any request validation errors to determine whether existing handlers, modules, or other custom code accesses potentially unsafe HTTP inputs that could be XSS attack vectors.

Do you need to host your ASP.NET 4.0 website?

What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the administrators who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other:

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your online business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in SSRS Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realize that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control Panel in 1 minute!

Happy hosting!



Team Foundation Server (TFS) 2010 Hosting with ASPHostCentral.com

clock April 29, 2010 10:48 by author Administrator

Team Foundation Server

Visual Studio Team System (VSTS) uses Team Foundation Server (TFS) as the data storage and collaboration backend. TFS provides a source control repository, work item tracking and reporting services. TFS works on "work items", which are a single unit of work which needs to be completed. Items themselves can be of several different types, such as a Bug, a Task, a Quality of Service Requirement, a Scenario, and so forth. The framework chosen for any given project in a TFS defines what types of work items are available and what attributes each type of work item contains.

ASPHostCentral.com, as the leading ASP.NET and Windows Hosting Provider, proudly announces the availability of Team Foundation Server 2010 service on all our hosting plans. You can always start from as low as $4.99/month to get this service.

TFS source control system stores all code, as well as a record of all changes and current check-outs in a SQL Server database. It supports features such as multiple simultaneous check-outs, conflict resolution, branching and merging, and the ability to set security levels on any level of a source tree. TFS uses SQL Server Reporting Service to create reports including the rate of code change over time, lists of bugs that don't have test cases, regressions on previously passing tests, and so on. The reports can be in various formats including XML and PDF.

TFS also includes a build server which can be used by developers to do a complete build of the most recent bits contained in source control. All build events are tracked by TFS as well. Visual Studio's Code Analysis, Test Tools and Code Coverage can be enabled to validate a build before it is deemed to be "good".

VSTS integrates with TFS using the TFS Client API, to expose the capabilities of TFS from within the Integrated Development Environment (IDE). It includes the Team Explorer to browse and manage the items in a team project. The version control capabilities, including browsing individual revisions, labeling revisions, check in/out and shelving in/out are available from the main IDE itself, via the Source Control Explorer. VSTS can use the TFS Team Build system, instead of the integrated build system. The VSTS IDE can also be used to view and create analysis reports in TFS as well. The Source Control Explorer can also be used to create and merge branches of the software. It also includes a diff engine for viewing the differences between different files and revisions.


Team Test Load Agent

In addition to Team Foundation Server, Microsoft also offers a server component called Team Test Load Agent. This tool, which is licensed separately from Team Foundation Server and Visual Studio, is intended for use by testers to perform automated load testing on a web or Windows application. Microsoft advertises that a "typical PC" can support simulating 1,000 simultaneous users. The results of load tests are stored in the Team Foundation Server warehouse, and can be linked to specific builds so that performance testing can be tracked over the lifetime of a project


Visual Studio Integration

The client-side applications are specialized versions of Microsoft Visual Studio 2005; collectively they are called the Visual Studio Team Editions. When Visual Studio 2005 was launched in November 2005, this consisted of editions for three distinct roles in application development: Developers, Architects, and Testers. A fourth edition, targeted at Database Developers, was subsequently developed and released towards the end of 2006. A "Team Suite" edition of Visual Studio 2005 is also available, which combines the tools in each of these four roles.

Team Explorer is a component included with Team Foundation Server that provides the client-side tools and integration. More specifically, this adds Team Foundation Server as a source control provider, and adds a "Team Explorer" window alongside the standard "Solution Explorer" window. Team Explorer includes a license for Visual Studio 2005 Premier Partner Edition for those without Visual Studio 2005 for the exclusive use of Team Explorer's functionality

 



ASP.NET 4 Hosting :: ASP.NET 4 SEO Improvements (VS 2010 and .NET 4.0 Series)

clock April 28, 2010 10:21 by author richard

The following article describes .NET Framework 4. In case you are looking for ASP.NET 4 Hosting, you can always consider ASPHostCentral and you can start from our lowest Standard Plan @$4.99/month to host your .NET 4 site.

Why SEO?

Search engine optimization (SEO) is important for any publically facing web-site.  A large percentage of traffic to sites now comes from search engines, and improving the search relevancy of your site will lead to more user traffic to your site from search engine queries (which can directly or indirectly increase the revenue you make through your site).

Measuring the SEO of your website with the SEO Toolkit

We blogged about the free SEO Toolkit we’ve shipped that you can use to analyze your site for SEO correctness, and which provides detailed suggestions on any SEO issues it finds. 

We highly recommend downloading and using the tool against any public site you work on.  It makes it easy to spot SEO issues you might have in the site, and pinpoint ways to optimize it further.

ASP .NET 4 SEO Improvement

ASP.NET 4 includes a bunch of new runtime features that can help you to further optimize your site for SEO.  Some of these new features include:

- New Page.MetaKeywords and Page.MetaDescription properties
- New URL Routing support for ASP.NET Web Forms
- New Response.RedirectPermanent() method

Below are details about how you can take advantage of them to further improve your search engine relevancy.

Page.MetaKeywords and Page.MetaDescription properties

One simple recommendation to improve the search relevancy of pages is to make sure you always output relevant “keywords” and “description” <meta> tags within the <head> section of your HTML.  For example:

<head runat=”server”>
           <title>My Page Title</title>
           <meta name=”keywords” content=”These, are, my, keywords” />
           <meta name=”description” content=”This is the description of my page” />
</head>

One of the nice improvements with ASP.NET 4 Web Forms is the addition of two new properties to the Page class: MetaKeywords and MetaDescription that make programmatically setting these values within your code-behind classes much easier and cleaner. 

ASP.NET 4’s <head> server control now looks at these values and will use them when outputting the <head> section of pages.  This behavior is particularly useful for scenarios where you are using master-pages within your site – and the <head> section ends up being in a .master file that is separate from the .aspx file that contains the page specific content.  You can now set the new MetaKeywords and MetaDescription properties in the .aspx page and have their values automatically rendered by the <head> control within the master page.

Below is a simple code snippet that demonstrates setting these properties programmatically within a Page_Load() event handler:

void Page_Load(object sender, EventsArgs e)
{
           Page.Title = “Setting the <head>’s <title> programmatically was already supported”;

           Page.MetaDescription = “Now you can set the <head>’s <meta> description too”;
           Page.MetaKeywords = “scottgu, blog, simple, sample, keywords”;
}

In addition to setting the Keywords and Description properties programmatically in your code-behind, you can also now declaratively set them within the @Page directive at the top of .aspx pages.

As you’d probably expect, if you set the values programmatically they will override any values declaratively set in either the <head> section or the via the @Page attribute.
 

URL Routing with ASP.NET Web Forms

URL routing was a capability we first introduced with ASP.NET 3.5 SP1, and which is already used within ASP.NET MVC applications to expose clean, SEO-friendly “web 2.0” URLs.  URL routing lets you configure an application to accept request URLs that do not map to physical files. Instead, you can use routing to define URLs that are semantically meaningful to users and that can help with search-engine optimization (SEO).

With ASP.NET 4.0, URLs like above can now be mapped to both ASP.NET MVC Controller classes, as well as ASP.NET Web Forms based pages.  You can even have a single application that contains both Web Forms and MVC Controllers, and use a single set of routing rules to map URLs between them.

Response.RedirectPermanent() Method

It is pretty common within web applications to move pages and other content around over time, which can lead to an accumulation of stale links in search engines.

In ASP.NET, developers have often handled requests to old URLs by using the Response.Redirect() method to programmatically forward a request to the new URL.  However, what many developers don’t realize is that the Response.Redirect() method issues an HTTP 302 Found (temporary redirect) response, which results in an extra HTTP round trip when users attempt to access the old URLs.  Search engines typically
will not follow across multiple redirection hops – which means using a temporary redirect can negatively impact your page ranking.  You can use the SEO Toolkit to identify places within a site where you might have this issue.

ASP.NET 4 introduces a new
Response.RedirectPermanent(string url) helper method that can be used to perform a redirect using an HTTP 301 (moved permanently) response.  This will cause search engines and other user agents that recognize permanent redirects to store and use the new URL that is associated with the content.  This will enable your content to be indexed and your search engine page ranking to improve.

Below is an example of using the new Response.RedirectPermanent() method to redirect to a specific URL:

Response.RedirectPermanent(“NewPath/ForOldContent.aspx”);

ASP.NET 4 also introduces new Response.RedirectToRoute(string routeName) and Response.RedirectToRoutePermanent(string routeName) helper methods that can be used to redirect users using either a temporary or permanent redirect using the URL routing engine.  The code snippets below demonstrate how to issue temporary and permanent redirects to named routes (that take a category parameter) registered with the URL routing system.

// Issue temporary HTTP 302 redirect to a named route
Response.RedirectToRoute(“Products-Browse”, new { category = “beverages” });

//Issue permanent HTTP 301 redirect to a named route
Response.RedirectToRoutePermanent(“Products-Browse”, new { category = “beverages” } );

You can use the above routes and methods for both ASP.NET Web Forms and ASP.NET MVC based URLs.

Summary


ASP.NET 4 includes a bunch of feature improvements that make it easier to build public facing sites that have great SEO.  When combined with the SEO Toolkit, you should be able to use these features to increase user traffic to your site – and hopefully increase the direct or indirect revenue you make from them.

Top Reasons to trust your ASP.NET 4 website to ASPHostCentral.com

What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other:

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in ASP.NET 4 RC Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control Panel in 1 minute!

Happy hosting!

<!--[endif]-->

 



ASP.NET 4 Hosting :: What's New in the .NET Framework 4

clock April 26, 2010 05:39 by author richard

The following article describes .NET Framework 4. In case you are looking for ASP.NET 4 Hosting, you can always consider ASPHostCentral and you can start from our lowest Standard Plan @$4.99/month to host your .NET 4 site.

Other new features and improvements in the .NET Framework 4 are described in the following sections:

1. Application Compatibility and Deployment
The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance.

The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio.

The following sections describe deployment improvements.

- Client Profile
The .NET Framework 4 Client Profile supports more platforms than in previous versions and provides a fast deployment experience for your Windows Presentation Foundation (WPF), console, or Windows Forms applications.

- In-Process Side-by-Side-Execution
This feature enables an application to load and start multiple versions of the .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on the .NET Framework 2.0 SP1 and add-ins that are based on the .NET Framework 4 in the same process.

2. Core New Features and Improvements
The following sections describe new features and improvements provided by the common language runtime and the base class libraries.

- Diagnostics and Performance
Earlier versions of the .NET Framework provided no way to determine whether a particular application domain was affecting other application domains, because the operating system APIs and tools, such as the Windows Task Manager, were precise only to the process level. Starting with the .NET Framework 4, you can get processor usage and memory usage estimates per application domain.

You can monitor CPU and memory usage of individual application domains. Application domain resource monitoring is available through the managed and native hosting APIs and event tracing for Windows (ETW). When this feature has been enabled, it collects statistics on all application domains in the process for the life of the process.

- Garbage Collection
The .NET Framework 4 provides background garbage collection. This feature replaces concurrent garbage collection in previous versions and provides better performance.

- Code Contracts
Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants. The contracts improve testing with run-time checking, enable static contract verification, and support documentation generation.

- Design-Time-Only Interop Assemblies
You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses. Type safety is ensured by the common language runtime.

- Dynamic Language Runtime
The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework.

The expression trees are extended with new types that represent control flow, for example, System.Linq.Expressions..::.LoopExpression and System.Linq.Expressions..::.TryExpression. These new types are used by the dynamic language runtime (DLR) and not used by LINQ.

In addition, several new classes that support the .NET Framework infrastructure are added to the System.Runtime.CompilerServices namespace.

- Covariance and Contravariance
Several generic interfaces and delegates now support covariance and contravariance.

- BigInteger and Complex Numbers
The new System.Numerics..::.BigInteger structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in support for this structure.

The new System.Numerics..::.Complex structure represents a complex number that supports arithmetic and trigonometric operations with complex numbers
.

- Tuples
The .NET Framework 4 provides the System..::.Tuple class for creating tuple objects that contain structured data. It also provides generic tuple classes to support tuples that have from one to eight components (that is, singletons through octuples). To support tuple objects that have nine or more components, there is a generic tuple class with seven type parameters and an eighth parameter of any tuple type.
 

- File System Enumeration Improvements
New file enumeration methods improve the performance of applications that access large file directories or that iterate through the lines in large files.

- Memory-Mapped Files
You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.

- 64-Bit Operating Systems and Processes
You can identify 64-bit operating systems and processes with the Environment..::.Is64BitOperatingSystem and Environment..::.Is64BitProcess properties
.

- Other New Features
The following list describes additional new capabilities, improvements, and conveniences. Several of these are based on customer suggestions.
1. To upport culture-sensitive formatting, the System..::.TimeSpan structure includes new overloads of the ToString, Parse, and TryParse methods, as well as new ParseExact and TryParseExact methods
.

2. The new String..::.IsNullOrWhiteSpace method indicates whether a string is null, empty, or consists only of white-space characters. New overloads have been added to the String.Concat and String.Join methods that concatenate members of System.Collections.Generic..::.IEnumerable<(Of <(T>)>) collections.

3. The String..::.Contract method lets you concatenate each element in an enumerable collection without first converting the elements to strings.

4. Two new convenience methods are available: StringBuilder..::.Clear and Stopwatch..::.Restart.

5. The new Enum..::.HasFlag method determines whether one or more bit fields or flags are set in an enumeration value. The Enum..::.TryParse method returns a Boolean value that indicates whether a string or integer value could be successfully parsed.

6. The System..::.Environment..::.SpecialFolder enumeration contains several new folders.

7. You can now easily copy one stream into another with the CopyTo method in classes that inherit from the System.IO..::.Stream class.

8. New Path..::.Combine method overloads enable you to combine file paths.

9. The new System..::.IObservable<(Of <(T>)>) and System..::.IObserver<(Of <(T>)>) interfaces provide a generalized mechanism for push-based notifications.

10. The System..::.IntPtr and System..::.UIntPtr classes now include support for the addition and subtraction operators.

11. You can now enable lazy initialization for any custom type by wrapping the type inside a System..::.Lazy<(Of <(T>)>) class.

12. The new System.Collections.Generic..::.SortedSet<(Of <(T>)>) class provides a self-balancing tree that maintains data in sorted order after insertions, deletions, and searches. This class implements the new System.Collections.Generic..::.ISet<(Of <(T>)>) interface.

13. The compression algorithms for the System.IO.Compression..::.DeflateStream and System.IO.Compression..::.GZipStream classes have improved so that data that is already compressed is no longer inflated. Also, the 4-gigabyte size restriction for compressing streams has been removed.

14. The new Monitor..::.Enter(Object, Boolean%) method overload takes a Boolean reference and atomically sets it to true only if the monitor is successfully entered.

15. You can use the Thread..::.Yield method to have the calling thread yield execution to another thread that is ready to run on the current processor.

16. The System..::.Guid structure now contains the TryParse and TryParseExact methods.

17. The new Microsoft.Win32..::.RegistryOptions enumeration lets you specify a volatile registry key that does not persist after the computer restarts.

Managed Extensibility Framework

The Managed Extensibility Framework (MEF) is a new library in the .NET Framework 4 that helps you build extensible and composable applications. MEF enables you to specify points where an application can be extended, to expose services to offer to other extensible applications and to create parts for consumption by extensible applications. It also enables easy discoverability of available parts based on metadata, without the need to load the assemblies for the parts.

Parallel Computing

The .NET Framework 4 introduces a new programming model for writing multithreaded and asynchronous code that greatly simplifies the work of application and library developers. The new model enables developers to write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool. The new System.Threading.Tasks namespace and other related types support this new model. Parallel LINQ (PLINQ), which is a parallel implementation of LINQ to Objects, enables similar functionality through declarative syntax.

Networking

Networking improvements include the following:

1. Security improvements for Windows authentication in several classes, including System.Net..::.HttpWebRequest, System.Net..::.HttpListener, System.Net.Mail..::.SmtpClient, System.Net.Security..::.SslStream, and System.Net.Security..::.NegotiateStream. Extended protection is available for applications on Windows 7 and Windows Server 2008 R2.

2. Support for Network Address Translation (NAT) traversal using IPv6 and Teredo.

3. New networking performance counters that provide information about HttpWebRequest objects.

4. In the System.Net..::.HttpWebRequest class, support for using large byte range headers (64-bit ranges) with new overloads for the AddRange method. New properties on the System.Net..::.HttpWebRequest class allow an application to set many HTTP headers. You can use the Host property to set the Host header value in an HTTP request that is independent from the request URI.


5. Secure Sockets Layer (SSL) support for the System.Net.Mail..::.SmtpClient and related classes.

6. Improved support for mail headers in the System.Net.Mail..::.MailMessage class.

7. Support for a null cipher for use in encryption. You can specify the encryption policy by using the System.Net..::.ServicePointManager class and the EncryptionPolicy property. Constructors for the System.Net.Security..::.SslStream class now take a System.Net.Security..::.EncryptionPolicy class as a parameter.

8. Credentials for password-based authentication schemes such as basic, digest, NTLM, and Kerberos authentication in the System.Net..::.NetworkCredential class. To improved security, passwords may now be treated as System.Security..::.SecureString instances rather than System..::.String instances.

9. Ability to specify how a URI with percent-encoded values is converted and normalized in the System..::.Uri and System.Net..::.HttpListener classes.

Web

ASP.NET version 4 introduces new features in the following areas:

1. Core services, including a new API that lets you extend caching, support for compression for session-state data, and a new application preload manager (autostart feature).

2. Web Forms, including more integrated support for ASP.NET routing, enhanced support for Web standards, updated browser support, new features for data controls, and new features for view state management.

3. Web Forms controls, including a new Chart control.

4. MVC, including new helper methods for views, support for partitioned MVC applications, and asynchronous controllers.

5. Dynamic Data, including support for existing Web applications, support for many-to-many relationships and inheritance, new field templates and attributes, and enhanced data filtering.

6. Microsoft Ajax, including additional support for client-based Ajax applications in the Microsoft Ajax Library.

7. Visual Web Developer, including improved IntelliSense for JScript, new auto-complete snippets for HTML and ASP.NET markup, and enhanced CSS compatibility.

8. Deployment, including new tools for automating typical deployment tasks.

9. Multi-targeting, including better filtering for features that are not available in the target version of the .NET Framework.

Client

Windows Presentation Foundation
In the .NET Framework 4, Windows Presentation Foundation (WPF) contains changes and improvements in many areas, including controls, graphics, and XAML.
 

Data

ADO. NET
ADO.NET provides new features for the Entity Framework, including Persistence-Ignorant Objects, functions in LINQ queries, and Customized Object Layer Code Generation.

Dynamic Data
For ASP.NET 4, Dynamic Data has been enhanced to give you even more power for quickly building data-driven Web sites. This includes the following:

- Automatic validation that is based on constraints that are defined in the data model.

- The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of a Dynamic Data project.

Communications and Workflow

Windows Communication Foundation (WCF) provides messaging enhancements and seamless integration with Windows Workflow Foundation (WF). WF provides improvements in performance, scalability, workflow modeling, and an updated visual designer.

Top Reasons to trust your ASP.NET 4 website to ASPHostCentral.com

What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other:

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in ASP.NET 4 RC Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control Panel in 1 minute!

Happy hosting!

 



ASP.NET 4 Hosting :: .NET Framework 4.0 A Parallel-Programming Initiative

clock April 23, 2010 12:49 by author richard

The following article describes .NET Framework 4. In case you are looking for ASP.NET 4 Hosting, you can always consider ASPHostCentral.com and you can start from our lowest Standard Plan @$4.99/month to host your .NET 4 site. We promise we’ll not disappoint you and we will give the best service for you. For us, the most important thing is you.

If you're an avid .NET programmer, you are likely aware of what the above title says. Since the birth of multi-core computing, there has been a need for parallel-programming architecture. Now, the multi-core computing has become the prevailing paradigm in computer architecture due to the invention of multi core-processors. By the way, almost every programmer considers Visual Studio 2008 and .NET Framework 3.5 as getting remote and out of the way. To avert its programming market fiasco, recently, Microsoft released the beta versions of .NET Framework 4 and Visual Studio 2010. The main focus fell on .NET 4, yet the labels boasted the advent of parallel-programming. The question is whether there are any advantages (more specifically towards performance) on sticking to existing APIs? This article attempts to briefly answer the question.

.NET 4's Multi-Core processing ability: First of all, the MSDN site shows that the parallel extensions in the .NET 4 , has been improved to support parallel programming, targeting multi-core computing or distributed computing. The support for the Framework has been categorized into four areas like library, LINQ, data structures and diagonastic tools. .NET 4's peers and predecessors lacked the multi-core operable ability. The main criteria like communication and synchronization of sub-tasks were considered as the biggest obstacles in getting a good parallel program performance. But .NET 4's promising parallel library technology enables developers to define simultaneous, asynchronous tasks without having to work with threads, locks, or the thread pool.

Full support for multiple programming languages and compilers: Apart from VB & C# languages, .NET 4 establishes full support for programming languages like Ironpython, Ironruby, F# and other similar .NET compilers. Unlike 3.5, it encompasses both functional-programming and imperative object-oriented programming.

Dynamic language runtime: Addition of the dynamic language runtime (DLR) is a boon to .NET beginners. Using this new DLR runtime environment, developers can add a set of services for dynamic languages to the CLR. In addition to that, the DLR makes it simpler to develop dynamic languages and to add dynamic features to statically typed languages. A new System Dynamic name space has been added to the .NET Framework on supporting the DLR and several new classes supporting the .NET Framework infrastructure are added to the System Runtime Compiler Services.

Anyway, the new DLR provides the following advantages to developers: Developers can use rapid feedback loop which lets them enter various statements and execute them to see the results almost immediately. Support for both top-down and more traditional bottom-up development. For instance, when a developer uses a top-down approach, he can call-out functions that are not yet implemented and then add them when needed. Easier refactoring and code modifications (Developers do not have to change static type declarations throughout the code)

Parallel-diagnostics: Unlike Visual Studio 2008, the new Visual Studio 2010 supports debugging and profiling, extensively. The new profiling tools provides various data views which displays graphical, tabular and numerical information about how a parallel or multiple-threaded application interacts with itself and with other programs. The results enable developers to quickly identify areas of concern, and helps in navigating from points on the displays to call stacks & source codes. If you think only parallel programming abilities and promising capabilities make the MS .NET 4.0 a more promising next generation programming tool, think again! That's not all. There are also a number of enhancements to the Base Libraries for things like collections, reflection, data structures, handling, threading and lots of new features for the web.

Top Reasons to trust your ASP.NET 4 website to ASPHostCentral.com

What we think makes ASPHostCentral.com so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other:

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in ASP.NET 4 Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 free applications directly via our Control Panel in 1 minute!

Happy hosting!                                             

 



ASP.NET 4 RC Hosting :: Overview of ASP.NET 4 RC

clock April 9, 2010 04:14 by author Administrator

The Microsoft .NET Framework 4 redistributable package installs the .NET Framework runtime and associated files that are required to run and develop applications to target the .NET Framework 4. The following article describes the overview of ASP.NET 4 RC technology in general and the improvements that have been done compared to the earlier version of ASP.NET4 . In case you are looking for ASP.NET 4 RC Hosting, you can always consider ASPHostCentral.com and you can start from our lowest Standard Plan @$4.99/month to host your .NET 4 site.

Overview

The .NET Framework is Microsoft's comprehensive and consistent programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes

The .NET Framework 4 works side by side with older Framework versions. Applications that are based on earlier versions of the Framework will continue to run on the version targeted by default.

The Microsoft .NET Framework 4 provides the following new features and improvements:

+ Improvements in CLR and BCL
      Performance improvement including better multicore support, background garbage collection, and profiler attach on server
     - New memory mapped file and numeric types
     - Easier debugging including dump debugging, Watson minidumps, mixed mode debugging for 64 bit and code contracts

+ Innovations in the Visual Basic and C# languages, for example statement lambdas, implicit line continuations, dynamic dispatch, and named/optional parameters

+ Improvements in ADO.NET
     - Entity Framework, which simplifies how developers program against relational databases by raising the level of abstraction. The Entity Framework has many new features in the .NET 4 Framework. These features include persistence ignorance and POCO support, Foreign Key Associations, lazy loading, test-driven development support, functions in model, and new LINQ operators
     - Data Services framework consists of a combination of patterns and libraries that enable the consumption of REST-based data services for the web. ADO.NET Data Services has many new features in the .NET 4 Framework. These features include: enhanced BLOB support, Data Binding, Row Count, Feed Customization, Projections, and Request Pipeline improvements. Built-in integration in Microsoft Office 2010 now makes it possible to expose Microsoft Office SharePoint Server data as a data service and access that data using the ADO.NET Data Services client library

+ Enhancements to ASP.NET
     - More control over HTML, element IDs and custom CSS that make it much easier to create standards-compliant and SEO-friendly web forms
     - New dynamic data features including new query filters, entity templates, richer support for Entity Framework 4, and validation and templating features that can be easily applied to existing web forms
     - Web forms support for new AJAX library improvements including built-in support for content delivery networks (CDNs).

+ Improvements in WPF
     - Added support for Windows 7 multi-touch, ribbon controls, and taskbar extensibility features
     - Added support for Surface 2.0 SDK
     - New line-of-business controls including charting control, smart edit, data grid, and others that improve the experience for developers who build data centric applications
     - Improvements in performance and scalability
     - Visual improvements in text clarity, layout pixel snapping, localization, and interoperability

+ Improvements to Windows Workflow (WF) that enable developers to better host and interact with workflows. These include an improved activity programming model, an improved designer experience, a new flowchart modeling style, an expanded activity palette, workflow-rules integration, and new message correlation features. The .NET Framework 4 also offers significant performance gains for WF-based workflows

+ Improvements to Windows Communication Foundation (WCF) such as support for WCF Workflow Services enabling workflow programs with messaging activities, correlation support. Additionally, .NET Framework 4 provides new WCF features such as service discovery, routing service, REST support, diagnostics, and performance

+ Innovative new parallel-programming features such as parallel loop support, Task Parallel Library (TPL), Parallel LINQ (PLINQ), and coordination data structures which let developers harness the power of multi-core processors

Reasons to trust your ASP.NET 4 RC website to ASPHostCentral.com

What we think makes
ASPHostCentral.com
so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other:

- 24/7-based Support - We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers
- Excellent Uptime Rate - Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP
- High Performance and Reliable Server - We never ever overload our server with tons of clients. We always load balance our server to make sure we can deliver an excellent service, coupling with the high performance and reliable server
- Experts in ASP.NET 4 RC Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostCentral
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install
more than 100 FREE applications
directly via our Control Panel in 1 minute!

Happy hosting!



WCF RIA Service Hosting :: WCF RIA Service Configuration in a Shared Hosting/Server

clock March 3, 2010 06:01 by author Administrator

The following article summarizes all the possible problems that may arise when deploying a WCF RIA Service application to a shared host. ASPHostCentral.com, as the premier ASP.NET and Windows Hosting provider, proudly presents this article to anyone and we believe it will help many ASP.NET communities; especially to those who are using WCF RIA Service. In case you are looking for WCF RIA Service Hosting, you can always consider ASPHostCentral.com and you can start from our lowest Standard Plan @$4.99/month to host your WCF-service site.

Why : RIA framework dynamically creates WCF service (Domain services) and add endpoints to the service. It first checks if endpoint does not exist then create it, and it checks for 3 endpoints (http, SOAP and binary). After creating end points it adds authentication schema to end points. It picks IIS authentication schemas and tries to apply on end points and failed to apply.

If we could create desired end points in web.config RIA framework will not create or do anything with endpoints and it works successfully.

You just need to follow the simple steps as mentioned on the followings:

1. Add following code to you web.config to solve issue “This collection already contains an address with scheme http..

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">

<baseAddressPrefixFilters>
<add prefix="http://www.yoursite.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>


Note: Your service can be only accessed by URL mentioned in above settings. As configured above you can’t access your service via http://yoursite.com. You could also use factory code to host WCF (see below) to resolve this error however alone with that you need to create svc files for each domain service.

2.Add AspNetCompatibilityRequirementsMode attribute to your RIA Domain services classes
Eg .Attributes added to AuthenticationService class under services folder

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

public class AuthenticationService : AuthenticationBase<User> { }


RIA framework dynamically apply these attributes after creating end points. Since we are now bypassing endpoint creation, we need to manually apply these attributes.

3. For each RIA domain service add following to you configuration file.
E.g. Is shown for AuthenticationService and UserRegistrationService
Where SparkExams is my custom namespace.
<services>

<service name="SparkExams.Web.AuthenticationService"
behaviorConfiguration="RIAServiceBehavior">
<endpoint address="" binding="wsHttpBinding"
contract="SparkExams.Web.AuthenticationService" />
<endpoint address="/soap"
binding="basicHttpBinding"
contract="SparkExams.Web.AuthenticationService" />
<endpoint address="/binary"
binding="customBinding"
bindingConfiguration="BinaryHttpBinding"
contract="SparkExams.Web.AuthenticationService" />
</service>

<service name="SparkExams.Web.UserRegistrationService"
behaviorConfiguration="RIAServiceBehavior">
<endpoint address=""
binding="wsHttpBinding"
contract="SparkExams.Web.UserRegistrationService" />
<endpoint address="/soap"
binding="basicHttpBinding"
contract="SparkExams.Web.UserRegistrationService" />
<endpoint address="/binary"
binding="customBinding" bindingConfiguration="BinaryHttpBinding"
contract="SparkExams.Web.UserRegistrationService" />
</service>


Please note that RIA adds 3 endpoints and if any of these endpoints are missing from web.config it will throw "IIS specified authentication schemes 'Basic, Anonymous'..." error.

Add following behaviours and bindings to your web.config
<behaviors>

<serviceBehaviors>
<behavior name="RIAServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="BinaryHttpBinding">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>


Test you WCF end points using WCF client test tool (Test client for Windows Communication Foundation services). WcfTestClient.exe : Go to VS 2008 Console and type WcfTestClient.exe.

Note that there is no need to host you service,or change IIS settings by ISP.

-----------------------------------------------------------------------------

Read further if you want to know how this configuration has been discovered...

1. Have Used Red Gate's .NET Reflector to examine RIA assemblies.
2. Plugin my custom DomainServiceHost factory to host service.
3. Set debug points on overridable methods "ApplyConfigutation()" in CustomHost
Please find code for class used to injected service host factory at the end of this post.
4. Check where the code was failing and what RIA has configured before failing.Found that it have configured 3 endpoints for each service. Noticed the minimal configuration and rectified other errors one by one.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Ria.Services;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Description;
using System.ServiceModel.Channels;
using System.ComponentModel;
using System.Web.DomainServices;
using System.Net;
namespace System.Web.Ria {
public class DomainServiceHostFactoryEx : DomainServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
Uri baseAddress=null;

try
{
baseAddress = baseAddresses[0];
}
catch (Exception e)
{
baseAddress = new Uri("http://localhost:52878");
}

CustomHost customServiceHost =
new CustomHost(serviceType, baseAddress);
return customServiceHost;
}
}

class CustomHost : DomainServiceHost
{
DomainServiceDescription _domainServiceDescription;
ServiceDescription _sdecreption;
ContractDescription _contract;
public CustomHost(Type serviceType, params Uri[] baseAddresses)
: base(serviceType, baseAddresses)
{
this._domainServiceDescription = DomainServiceDescription.GetDescription(serviceType);

}

protected override ServiceDescription CreateDescription(out IDictionary<string, ContractDescription> implementedContracts)
{
ServiceDescription d = base.CreateDescription(out implementedContracts);
//_contract = implementedContracts[0];
_sdecreption = d;
return d;
}
protected override void ApplyConfiguration()
{
//base.LoadConfigurationSection(new System.ServiceModel.Configuration.ServiceElement(_sdecreption.ConfigurationName));
// try
//{
string error = "";
try
{
base.ApplyConfiguration();
}
catch (Exception applyconfigerror) { error += "Error1:" + applyconfigerror.Message + "\r\n"; }

try
{
//this.AddEndpoints();
}
catch (Exception applyconfigerror) { error += "Error2:" + applyconfigerror.Message + "\r\n"; }

try
{
// this.AddDefaultBehaviors();
}
catch (Exception applyconfigerror) { error += "Error3:" + applyconfigerror.Message + "\r\n"; }


//if (error.Length > 0) HttpContext.Current.AddError(new Exception( error));

//this.AddEndpoints();
//this.AddDefaultBehaviors();

using (IEnumerator<ServiceEndpoint> enumerator = base.Description.Endpoints.GetEnumerator())
{
while (enumerator.MoveNext())
{
ServiceEndpoint current = enumerator.Current;
//current.Binding.Scheme
}
}

//}
//catch (Exception ex)
// {
//HttpContext.Current.AddError(ex);
// }

}
}
}



ASP.NET 4 Hosting :: Working with a Database using Model-First Development Technique

clock March 2, 2010 11:15 by author Administrator

Introduction


The upcoming release of Visual Studio 2010 will contain the Entity Framework 4 which is Microsoft's second release of the Entity Framework.  The new and improved EF4 contains a boat load of new features which many developers have suggested after using version 1.  It also comes closer to the features offered in other Object-Relational Mapping tools such as NHibernate.  Object-Relational Mapping tools are used to eliminate much of the tedious code needed to have an application persist and retrieve data from a database.  The developer uses a visual interface to build classes that map to tables, relationships, stored procedures, and other objects in a database.  One of the great new features of EF4 is the ability to create an ADO.NET Entity Data Model and then build the database from the model.  Previously the developer needed to create the database first and then generate the model.  EF4 still supports reverse engineering a database but being able to use Visual Studio to design a database based off of an object model is a big step forward with this tool.

Today, we are going to discuss a way to create a database using Model-First Development Technique. ASPHostCentral.com, as the premier ASP.NET and Windows Hosting provider, proudly presents this article to anyone and we believe it will help many ASP.NET communities; especially to those who are using ASP.NET 4 Framework. In case you are looking for ASP.NET 4 Hosting, you can always consider ASPHostCentral.com and you can start from our lowest Standard Plan @$4.99/month to host your WCF-service site.

The goal of this article is to show you how to create an ADO.NET Entity Data Model using the Entity Framework 4.  This article uses Visual Studio 2010 Beta 2 so some of the steps may change once the final version is released to production.  Future articles will build upon this application to dive deeper into the EF4 to demonstrate how to query and display data, incorporate stored procedures, customize the classes generated by the EF4, and much more.


Creating a Database using Model-First Development


Step 1: Create a New Solution

1. Launch Visual Studio 2010 Beta 2
2. Click the New Project link on the Start Page.  The New Project dialog box should appear
3. Click on the Visual C# node from the tree view of installed templates
4. Select Empty ASP.NET Web Application from the list of templates
5. Enter OrderSystem for the project name and click the OK button

Visual Studio will create a solution file in the folder you specified and also create a sub folder that contains the web site's project file and config files


Step 2: Create an ADO.NET Entity Data Model

The next step is to create the ADO.NET Entity Data Model.  For this application we'll model the concept of users and addresses.  A user can have more than one address so we'll build an entity data model that models this relationship

1. Right click on the OrderSystem project in the Solution Explorer and select Add à New Item…
2. Click the Data node under the Visual C# node in the Installed Templates tree
3. Select the ADO.NET Entity Data Model template
4. Change the name to OrderDB.edmx and click the Add button
5. Visual Studio will display the Entity Data Model Wizard.  This is where you can decide to build the model from an existing database or create the model first and then build the database
6. Choose Empty model from the wizard and click the Finish button

The OrdersDB.edmx file will be added to your project and the file will be displayed in the Entity Framework Designer


Step 3: Create the Entities and Associations


The next step is to model the user and user's addresses relationship. Let's first create the user entity.

1. Right click on the Entity Data Model Designer and select AddàEntity… from the pop-up menu
2. The Add Entity dialog box should appear.  Enter UserAccount for the Entity name.  Notice that as you type the Entity name the Entity Set name pluralizes the Entity name.  Think of the Entity name as the class that represents a record and the Entity set as the class that represents the table of those records
3. By default the Entity Framework will create a Primary Key called Id.  If you wish to not create a primary key you can uncheck the Create key property checkbox from the dialog box.  For this example we want a primary key so leave the box checked
4. Click the OK button. The UserAccount entity will be added to the entity diagram
5. The next step is to add properties to this entity. Properties will map to fields in a table. We'll first add the First and Last name properties
6. Right click on the UserAccount entity and select AddàScalar property from the pop-up menu
7. Change the property name to FirstName
8. In the properties window change the MaxLength to 50. Scalar properties are strings by default
9. Add another property called LastName the same way and set its MaxLength to 50

The next step is to add and insert date and update date properties.  I like to have the inserted and updated dates on every entity just for the sake of trouble shooting.  These are two properties that will be added to every entity so it is the perfect candidate for a Complex Type.  A Complex Type allows you to define a set of properties and then associate them with multiple entities.

10. In the Model Browser window, left click on the Complex Types nodes.  Sometimes you have to click more than once for the node to be selected.  I'm using Beta 2 so hopefully this will be fixed when it goes live.  Once the node is selected right click and select Create Complex Type from the pop-up menu



11. Change the name of the complex type to AuditFields
12. Right click on the AuditFields complex type in the Model Browser and select AddàScalar PropertyàDateTime from the pop-up menu
13. Change the name to InsertDate
14. Follow the same steps to add the UpdateDate property to the complex type
15. Now you can add the Complex property to the UserAccount entity.  Right click the UserAccount entity and select AddàComplex Property from the pop-up menu
16. Change the name to AuditFields.  The type should have already defaulted to AuditFields

When the database is created from this entity it will contain the two audit fields defined in the complex type.Now let's add the address entity.  A user can have more than one address so there is a one-to-many relationship between these two entities

17. Right click the designer and select AddàEntity from the pop-up menu
18. Change the name to Address and then click the OK button
19. Add scalar properties to the Address entity for Address1, Address2, City, State, and Zip.  All of these properties should be strings with lengths of 50, 50, 50, 2, and 5 respectively
20. Change Address2 to be nullable by settting the Nullable property to True in the properties window.  All other properties are required
21. Now add the Audit Fields to this entity by right clicking the Address entity and selecting AddàComplex Property from the pop-up menu.  Set the name to AuditFields and the type to AuditFields

The next step is to create an association between the UserAccount and Address entities.

22. Right click on the UserAccount entity and select AddàAssociation from the pop-up menu
23. The Add Association dialog appears.  It assumes correctly that you want to create a one-to-many relationship between these two entities.  You use the Multiplicity drop down to define the variations of relationships but for this example you can leave the defaults and click the OK button.  Notice that a UserAccountId property was added to the Address table

Step 4: Generate the Database

Now that the entities are defined we can create the database.  Visual Studio makes this quite simple.  A script is generated with the correct DDL statements to create tables, indexes, and relationships which you can then execute against your database

1. Right click on the Designer and select Generate Database from Model… from the pop-up menu.  The Generate Database Wizard will appear
2. Click the New Connection… button
3. Enter your Server Name. Choose either User Windows Authentication or Use SQL Server Authentication.  Whichever you choose you need a user that has permissions to create a database on the server.  For this example I'll use Windows Authentication
4. Enter OrderSystem for the name of the database and click the OK button
5. You should get a message stating "The database 'OrderSystem' does not exist or you do not have permissions to see it.  Would you like to attempt to create it?"  Click the Yes button
6. The database should be created and you'll be returned to the Generate Database Wizard dialog.  Click the Next button
7. The wizard will now generate the DDL statements needed to create this database
8. Click the Finish button
9. A new file will be added to the project called OrderDB.edmx.sql. The file contains the DDL statements to create the database.  The text of the file is as follows:
-- --------------------------------------------------

-- Date Created: 01/17/2010 09:39:04

-- Generated from EDMX file: C:\Documents and Settings\VinceVarallo\

-- my documents\visual studio 2010\Projects\OrderSystem\OrderSystem\OrderDB.edmx

-- --------------------------------------------------

 

SET QUOTED_IDENTIFIER OFF;

SET ANSI_NULLS ON;

GO

 

USE [OrderSystem]

GO

IF SCHEMA_ID(N'dbo'IS NULL EXECUTE(N'CREATE SCHEMA [dbo]')

GO

 

-- --------------------------------------------------

-- Dropping existing FK constraints

-- --------------------------------------------------

 

 

-- --------------------------------------------------

-- Dropping existing tables

-- --------------------------------------------------

 

 

-- --------------------------------------------------

-- Creating all tables

-- --------------------------------------------------

 

-- Creating table 'UserAccounts'

CREATE TABLE [dbo].[UserAccounts] (

    [Id] int  NOT NULL,

    [FirstName] nvarchar(50)  NOT NULL,

    [LastName] nvarchar(50)  NOT NULL,

    [AuditFields_InsertDate] datetime  NOT NULL,

    [AuditFields_UpdateDate] datetime  NOT NULL

);

GO

-- Creating table 'Addresses'

CREATE TABLE [dbo].[Addresses] (

    [Id] int  NOT NULL,

    [Address1] nvarchar(50)  NOT NULL,

    [Address2] nvarchar(50)  NULL,

    [City] nvarchar(50)  NOT NULL,

    [State] nvarchar(2)  NOT NULL,

    [Zip] nvarchar(5)  NOT NULL,

    [AuditFields_InsertDate] datetime  NOT NULL,

    [AuditFields_UpdateDate] datetime  NOT NULL,

    [UserAccountId] int  NOT NULL

);

GO

 

-- --------------------------------------------------

-- Creating all Primary Key Constraints

-- --------------------------------------------------

 

-- Creating primary key on [Id] in table 'UserAccounts'

ALTER TABLE [dbo].[UserAccounts] WITH NOCHECK 

ADD CONSTRAINT [PK_UserAccounts]

    PRIMARY KEY CLUSTERED ([Id] ASC)

    ON [PRIMARY]

GO

-- Creating primary key on [Id] in table 'Addresses'

ALTER TABLE [dbo].[Addresses] WITH NOCHECK 

ADD CONSTRAINT [PK_Addresses]

    PRIMARY KEY CLUSTERED ([Id] ASC)

    ON [PRIMARY]

GO

 

-- --------------------------------------------------

-- Creating all Foreign Key Constraints

-- --------------------------------------------------

 

-- Creating foreign key on [UserAccountId] in table 'Addresses'

ALTER TABLE [dbo].[Addresses] WITH NOCHECK 

ADD CONSTRAINT [FK_UserAccountAddress]

    FOREIGN KEY ([UserAccountId])

    REFERENCES [dbo].[UserAccounts]

        ([Id])

    ON DELETE NO ACTION ON UPDATE NO ACTION

GO

 

-- --------------------------------------------------

-- Script has ended

-- --------------------------------------------------


It is important to note that the tables weren't added to the database yet.  In order to actually create the tables you need to right click in the OrderDB.edmx.sql file and select Execute SQL from the pop-up menu.  You'll be prompted to log into the server that contains your database.  Once you are logged in the script will execute and the objects will be added to your database


Conclusion

That's all you need to do to create a database using the new Entity Framework's Model First methodology. This is a big improvement over the first edition because it allows you to use Visual Studio to work through the design of you objects first and then VS can figure out how to create the database tables, indexes, and relationships for you.





ASP.NET 4.0 & ASP.NET 4.5 Hosting

 

ASPHostCentral is a premier web hosting company where you will find low cost and reliable web hosting. We have supported the latest ASP.NET 4.5 hosting and ASP.NET MVC 4 hosting. We have supported the latest SQL Server 2012 Hosting and Windows Server 2012 Hosting too!

 

Calendar

<<  January 2025  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Sign in