WebMatrix Beta 2 Release Readme

This article has been archived for one of the following reasons:

  • It contains information that no longer applies, that is inaccurate, or that is duplicated in a current article.
  • It contains inaccurate or incomplete information and is being rewritten. We are working on new content and will replace this article when it’s ready.
  • Published on October 06, 2010 by mikepope
  • Updated on November 08, 2010 by mikepope

Contents

Note   This readme applies to the Beta 2 release of WebMatrix. For information about the Beta 3 (most recent) release, see Web Matrix and ASP.NET Web Pages (Razor) Beta 3 Release Readme. (For information about the Beta 1 release, see the WebMatrix Beta Release Readme.)

Overview

Microsoft WebMatrix Beta is a free web development stack that installs in minutes. It integrates a web server with database and programming frameworks to create a single, integrated experience. You can use WebMatrix Beta to streamline the way you code, test, and publish your own ASP.NET or PHP website, or you can use WebMatrix Beta to start a new website using popular open-source apps like DotNetNuke, Umbraco, WordPress, or Joomla. WebMatrix Beta uses the same powerful web server, database engine, and frameworks environment that will run your website on the internet, which makes the transition from development to production smooth and seamless.

Installation

To install WebMatrix Beta 2, you use Microsoft Platform Installer 3.0. After you've installed the Web Platform Installer, you can use it to install WebMatrix Beta 2.

If you have problems during installation, refer to Troubleshooting Problems with Microsoft Web Platform Installer.

Instructions for Publishing Applications

See Step-by-Step Instructions for Publishing Applications

New Features, Changes, and Known Issues

WebMatrix Beta 2 Installation

Issue: WebMatrix Beta 2 is only available on platforms that support Microsoft .NET Framework 4

The .NET Framework version 4 is required for WebMatrix Beta. In certain cases, the WebMatrix Beta installer will let you try to install on a platform that is not part of the supported configuration set. In particular, Windows Vista without the SP1 update will let you begin the installation of WebMatrix Beta, but the .NET Framework v4 component will fail and block your installation.

Workaround
Install on a supported platform, which includes:

  • Windows 7
  • Windows Server 2008
  • Windows Server 2008 R2
  • Windows Vista SP1 or later
  • Windows XP SP3
  • Windows Server 2003 SP2

Issue: Cannot install WebMatrix Beta 2 if Microsoft Visual Studio 2008 is installed without Microsoft Visual Studio 2008 SP1

Workaround
Install Microsoft Visual Studio 2008 SP1 from the Microsoft Download Center.

Issue: Some assemblies for SQL Server Compact 4.0 are not installed in the GAC

The managed assemblies for SQL Server Compact 4.0 are not placed in the global assembly cache (GAC) when you install SQL Server Compact 4.0 on a 64-bit computer and the computer has only the .NET Framework 3.5 SP1 Client Profile installed. The managed assemblies that are not installed in the GAC are:

  • System.Data.SqlServerCe.dll (ADO.NET provider)
  • System.Data.SqlServerCe.Entity.dll (ADO.NET Entity Framework )

Workaround
Uninstall SQL Server Compact 4.0. Download and install the full version of .NET Framework 3.5 SP1 from the following location:

Microsoft .NET Framework 3.5 Service pack 1 (Full Package)

Then reinstall SQL Server Compact 4.0.

Issue: Cannot uninstall SQL Server Compact using the command line

Uninstallation of SQL Server Compact using command-line options does not work in this release.

Workaround
Use Programs and Features in the Windows Control Panel to uninstall Microsoft SQL Server Compact 4.0.

ASP.NET Web Pages

This file describes new features, changes, and known issues with the Beta 2 release of ASP.NET Web Pages with Razor syntax.

New Features in Beta 2 for ASP.NET Web Pages with Razor Syntax

New: Helpers added in Beta 2

The following helpers were added in the Beta 2 release:

  • Antiforgery
  • Bing
  • Json
  • Themes

For more information, see the ASP.NET Quick API Reference.

New: Package support added for ASP.NET Web Pages

You can now install packages, which are components that encapsulate functionality for ASP.NET Web Pages. For example, some of the helpers available for ASP.NET Web Pages are now included in the Microsoft Web Helpers library package that you install separate from WebMatrix. The list of packages that are available is available as a feed, meaning that the list is dynamic.

To view and install packages, run a page in your site (using IIS Express) and then in the browser's URL box, replace the name of the page (for example, default) with _Admin. This invokes the package manager, which lets you view, select, and install packages. (The first time you run _Admin, you are prompted to create a password.)

For more information, see "Installing the Microsoft Helpers Library" in the tutorial Getting Started with ASP.NET Pages.

New: New @helper syntax introduced for declarative helpers   

The Beta 2 release lets you create helpers declaratively that can include HTML markup and ASP.NET Razor code. This lets you create reusable content that you can invoke anywhere in an ASP.NET Web Pages page by using helper syntax. The following example shows a simple declarative helper.

 @helper MakeNote(string content) {
<div class="note" style="border:1px solid black; width: 90%; padding: 5px; margin-left: 15px;">
<p> <strong>Note</strong>&nbsp;&nbsp; @content
</p>
</div> }

For more information, including the syntax for how to use a declarative helper, see the tutorial Creating a Consistent Look.

New: Request validation enabled at the field level

In the Beta 1 release, request validation could effectively be disabled for .cshtml and .vbhtml files by using settings in the Web.config file, but this had the effect of turning off request validation for all Razor pages in the website. In Beta 2, you can configure request validation for .cshtml or .vbhtml pages in page code, either for individual fields on the page or for the page as a whole.

Note   If you do not disable request validation, if users try to upload HTML markup (for example, by using a rich text editor on a page), the website will report an error like A potentially dangerous Request.Form value was detected from the client and the user input is not accepted. If you disable request validation, you must manually check user input to make sure that it does not contain potentially dangerous markup or script using something like the Microsoft Anti-Cross Site Scripting Library V3.1.

To disable validation for an individual field or set of fields, call the Validation.Exclude method, passing in the name or names of the fields to exclude from validation:

@{
    Validation.Exclude("description");
}
<html>
<body>
  <form method="post" action="">
    <div>Name:<br /><input type="text" name="name" /></div>
    <div>Description:<br /><textarea name="description"></textarea></div>
    <div><input type="submit" value="Submit" /></div>
</form>
@if (IsPost) {
  <span>Your description: @Request["description"]</span>
}
</body>
</html>

To disable validation for multiple fields, use syntax like this:

Validation.Exclude("description", "name");

To disable validation for the entire page (including cookies and other Request elements), call the Validation.ExcludeAll method:

Validation.ExcludeAll();

Changes in Beta 2 for ASP.NET Web Pages with Razor Syntax

Change: ASP.NET Razor commenting syntax changed

The syntax for including comments has changed. The old syntax was this:

@// Your code comment here.

@/* 
    A multi-line 
    server-code comment  
*/

The new syntax is this:

@*  A one-line code comment. *@
	
@* 
    A multi-line comment. 
    server-code comment
*@

This change affects only comments that use the old Razor commenting syntax. Comments that use language-specific syntax (such as // or /* */ in C# or ' in Visual Basic) still work as is within code blocks.

Change: "Database.OpenFile" removed, "Database.Open" recommended

In Beta 2, ASP.NET Web Pages supports two methods for opening database files or connections, as shown in the following examples:

Database.Open("SmallBakery");

Database.OpenConnectionString("server=myServer;database=myDatabase;providerName="System.Data.SqlClient");

The Database.OpenFile method has been removed.

The recommended method is Database.Open, because it makes it easy to migrate a SQL Server Compact database (.sdf file) to a full version of SQL Server. When you pass a name to Database.Open, the method first looks for a connection string of that name in the Web.config file. If no such connection string exists, the method adds ".sdf" and ".mdf" to the name and then looks in the App_Data folder for a database of that name. This lets you use a local .sdf file for development, but then at deployment time, create a connection string that has the same name and that points to the SQL Server instance on the hosting site.

For more information, see the tutorial Working with Data.

Change: Some types and members have been renamed

Some types and members (including some helpers) have been renamed in order to avoid conflict with types in .NET Framework namespaces or to better reflect their semantics. The following table lists changes.

Old name New name
Mail WebMail
LayoutPage Layout
Response.WriteJson Response.Write(Json.Encode(<object>))

Change: "RenderSection" method "Optional" parameter renamed to "Required" and meaning reversed

In the Beta 1 version of ASP.NET Web Pages, the RenderSection method used in layout pages supports an optional parameter that lets you specify that the content page does not have to provide content for that section:

@* Syntax for Beta 1 release *@
@RenderSection("scripts", optional: true);

In the Beta 1 release, if a layout page includes a RenderSection method that does not include the optional parameter, and if content is not provided for that section, an error occurs.

The semantics of this parameter have changed in the Beta 2 release. The parameter is now named required. To make a section optional, you set required to false, as in this example:

@* Syntax for Beta 2 release *@
@RenderSection("scripts", required: false);

The behavior continues to be that a section is required unless this parameter is set to make the section optional.

Change: Changes to setting global application and page values

In the Beta 1 release, you can set application-wide (that is, global) values using the AppData dictionary in the _start.cshtml file. Similarly, in Beta 1, you can set page values in the _init.cshtml file using the PageData dictionary.

The Beta 2 release features two changes to these settings:

  • The files have been renamed:
     
    • _start.cshtml is now _AppStart.cshtml
    • _init.cshtml is now _PageStart.cshtml
  • The AppData dictionary has been renamed to AppState.
  • Dynamic App and Page properties are now available that provide an alternative way to using the dictionary to set and get the values. These properties provides access to the same data that the dictionaries do, but provide a convenient way to use the values.

The following example shows how to use the App property.

@* _AppStart.cshtml *@
@{
    // Using dictionary
    AppState["SiteName"] = "My Site";

    // Using dynamic property
    App.SiteName = "My Site";
}
<!DOCTYPE html>
<html>
<body>
  <p>Site name: @AppState["SiteName"]</p>
  <p>Welcome to @App.SiteName</p>
</body>
</html>

The following examples shows how to set the Page property in the _PageStart.cshtml file, and then to reset it in the code for an individual page. You can set these values anywhere that's specific to the current request (in effect, anywhere except in the _AppStart.cshtml file).

@* _PageStart.cshtml *@
@{
    Page.Title = "My Site";
}
@* Default.cshtml *@
@{
  Layout = "_Layout.cshtml";
  Page.Title = "My Page " + Page.Title;
}
<div>Some text</div>

@* _Layout.cshtml *@
<html>
    <head>
        <!-- Renders "My Page - My Site" -->
        <title>@Page.Title</title>
    </head>
    <body>@RenderBody()</body>
</html>

For more information about using these files, see the tutorial Customizing Site-Wide Behavior.

Note for Visual Basic users   Due to restrictions in how Visual Basic works, you cannot use the dynamic App and Page properties unless the application is running in full trust (that is, if it is running in medium trust). However, you can use the AppData and PageData dictionaries no matter what trust level the application is running at. It is anticipated that this will be fixed in a future version of the .NET Framework.

Note also that if you are using Visual Basic, the filename extensions are .vbhtml for example, _AppStart.vbhtml.

Change: Parsing of URLs reversed

In the Beta 1 release, URLs are parsed left to right. As soon as ASP.NET finds a page that matches a segment of the URL, the page is invoked and the remaining segments of the URL are passed to the page as data. As a result, in Beta 1, ASP.NET is not able to find pages that matched more specific segments of the URL if a more general page existed. For example, imagine this URL

http://mysite/subpage1/page1

And imagine that you have this structure in the website:

\subpage1.cshtml
\subpage1\page1.cshtml

In the Beta 1 release, the URL would resolve to subpage1.cshtml and pass "page1" as data to the page.

In Beta 2, the parsing has been reversed so that ASP.NET finds the more specific page first. In the example, ASP.NET would find page1.cshtml when the example URL is used.

For more information about how URLs are parsed, see "Creating More Readable and Searchable URLs" in the tutorial Customizing Site-Wide Behavior.

Known Issues for ASP.NET Web Pages with Razor Syntax

Issue: "<helper> class cannot be found" error

After you upgrade from Beta 1 to Beta 2, you might see an error that a helper class (for example, the Twitter class) cannot not be found. This is because WebMatrix does not upgrade any existing sites. This includes sites in the \My Documents\IISExpress or \My Documents\My Web Sites folders. In particular, you will see this error if you use the default site in My Sites (WebSite1), which includes a reference to the Twitter helper.

Workaround
Comment out calls to any helpers in the site, run the _Admin page, and install the microsoft-web-helpers 1.0 package. (For details, see New: Package support added for ASP.NET Web Pages later in this document.) After you've installed the package, you can uncomment the lines that reference helpers.

Issue: Deploying Beta 2 ASP.NET Razor assemblies to the Bin folder might not work on hosting sites

If you deploy an ASP.NET Web Pages website to a hosting site, and if you deploy the ASP.NET Razor Beta 2 assemblies to the site's Bin folder, you might experience errors, including the following:

Could not load type 'Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility' from assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

This can happen if the hosting provider has installed the ASP.NET Web Pages Beta 1 assemblies into the server's global application cache (GAC). Assemblies in the GAC get precedence over assemblies installed locally in the Bin folder.

Workaround Contact your hosting provider to confirm that the errors you are seeing are due to a conflict between the provider's versions of the assemblies and yours. If so, request that the hosting provider update the assemblies in the server's GAC.

Issue: Reading feeds or other external data via a proxy server

If the server running the site is behind a proxy server, you might need to configure proxy information in the Web.config file in order to be able to read information that comes from outside your site. For example, if you use the ReCaptcha helper, the helper communicates with the reCAPTCHA service, but might be blocked by your proxy server. Similarly, feeds that are used in ASP.NET Web Pages, such as the feed used by the package manager, might require proxy configuration.

If you experience problems in working with an external service or working with the package feed, put the following elements into your application's root Web.config file:

<system.net>
  <defaultProxy>
    <proxy autoDetect="False" 
       proxyaddress="[proxy URL]"/>
  </defaultProxy>
</system.net>

For more information about configuring a proxy server, see <proxy> Element (Network Settings) on the MSDN Web site.

Issue: "Microsoft.Web.Infrastructure.dll" cannot be loaded error

If you previously installed the Beta 1 version of ASP.NET Web Pages with Razor syntax and then install the Beta 2 version, all appropriate assemblies are installed in the GAC except Microsoft.Web.Infrastructure.dll. As a consequence, when you run ASP.NET Razor pages, you see an error that indicates that Microsoft.Web.Infrastructure.dll could not be loaded.

This issue does not occur if you loaded the Beta 2 release on a clean computer.

Workaround
In Control Panel, uninstall ASP.NET Web Pages. Then reinstall the Beta 2 release.

Issue: "Culture is not supported" error

If you run a .cshtml or .vbhtml page with a browser that's set to a culture setting that ASP.NET does not recognize, ASP.NET throws a "culture is not supported" error. For example, if the browser's language is set to zh-US (an unknown culture/locale combination), you will see this error. (The correct behavior is that ASP.NET should fall back to a default culture setting; it's anticipated that this will be fixed in a future release.)

Workaround
Explicitly set the language of the browser to a known culture/locale.

Issue: Uninstalling the .NET Framework version 4 disables ASP.NET Web Pages with Razor Syntax

If you uninstall the .NET Framework version 4 and then reinstall it, ASP.NET Web Pages with Razor syntax is disabled. Pages with the .cshtml extension do not run correctly. ASP.NET Web Pages registers an assembly in the machine root Web.config file, and removing the .NET Framework removes that file. Reinstalling the .NET Framework installs a new version of the configuration file, but does not add the reference for the ASP.NET Web Pages assembly.

Workaround After reinstalling the .NET Framework, reinstall ASP.NET Web Pages with Razor syntax. This adds the following element to the Web.config file in the machine root, which is typically in the following location:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config (32-bit)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config (64-bit)

<compilation>
  <assemblies>
    <add assembly="Microsoft.WebPages.Configuration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <-- Additional assemblies here. -->

  </assemblies>
</compilation>

Issue: Applications previously deployed with ASP.NET assemblies in the Bin folder experience errors

During deployment, copies of the ASP.NET Web Pages assemblies (for example, Microsoft.WebPages.dll) to the Bin folder of the website on the server. (This might have happened automatically during deployment or because the developer explicitly copied the assemblies.) However, when the Beta 2 release is installed, errors occurs, such as errors that certain types cannot be found. This occurs because a number of ASP.NET Web Pages types were moved into different namespaces for the Beta 2 release.

Workaround Clear the Bin folder of the deployed application, copy the new assemblies to the folder (or redeploy the application), and then restart the application.

Issue: Extensionless URLs do not find .cshtml/.vbhtml files on IIS 7 or IIS 7.5

On IIS 7 or IIS 7.5, requests with a URL like the following are not able to find pages that have the .cshtml or .vbhtml extension:

http://www.example.com/ExampleSite/ExampleFile

The issue arises because URL rewriting is not enabled by default for IIS 7 or IIS 7.5. The likeliest scenario is that you do not see the problem when testing locally using IIS Express, but you experience it when you deploy your website to a hosting website.

Workaround

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

Issue: Using WAP or MVC and ASP.NET Web pages in the same application

If you were using ASP.NET Web Pages in a WAP or MVC application, you might see an error that WebPageHttpApplication can not be found.

Workaround
If you get this error, change the base class from which the application derives. In the Global.asax file, change the following line:

public class MvcApplication :  WebPageHttpApplication { ... }

To this:

public class MvcApplication :  HttpApplication { ... }

This in effect reverses a change that was introduced for the Beta 1 release of ASP.NET Web Pages with Razor syntax.

Issue: Deploying an application to a computer that does not have SQL Server Compact installed

Applications that include SQL Server Compact databases can run on a computer where SQL Server Compact is not installed. Microsoft WebMatrix Beta 2 automatically copies these binaries for you and performs the appropriate web.config transforms.

If for some reason you need to copy these files and make the web.config changes manually:

Workaround

  1. Copy the database engine assemblies to the \Bin folder (and subfolders) of the application on the target computer:
    • Copy C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll to \Bin
    • Copy C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private\x86\* to \Bin\x86
    • Copy C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private\amd64\* to \Bin\amd64
  2. In the root folder of the website, create or open a Web.config file. (In WebMatrix Beta 2, this file type is available if you click All in the Choose a File Type dialog box.)
  3. Add the following element as a child of the <configuration> element (not inside the <system.web> element):
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.4.0"
Description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>

Issue: Database and WebGrid helpers do not work in Medium Trust in Visual Basic

If you are using Visual Basic (creating .vbhtml files), the Database and WebGrid helpers will not work if the application is set to use Medium Trust.

Workaround
Temporarily set the application to use Full Trust.

SQL Server Compact

Issue: The "Encrypt" property is not recognized

SQL Server Compact 4.0 does not recognize the Encrypt property of the SqlCeConnection class. You should not use this property to encrypt database files. The Encrypt property was deprecated in SQL Server Compact 3.5 release and was retained only for backward compatibility.

Workaround
Use the Encryption Mode property of the SqlCeConnection class to encrypt SQL Server Compact 4.0 database files. The following example shows how to create an encrypted SQL Server Compact 4.0 database using the Encryption Mode property:

C#

SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;");
engine.CreateDatabase();

Visual Basic

Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;")
engine.CreateDatabase()

To change the encryption mode of an existing SQL Server Compact 4.0 database, do the following:

C#

SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;Password=<enterStrongPasswordHere>;");
engine.Compact("Data Source=Northwind.sdf;encryption mode=ppc2003 compatibility;Password=<enterStrongPasswordHere>;");

Visual Basic

Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;Password=<enterStrongPasswordHere>;")
engine.Compact("Data Source=Northwind.sdf;encryption mode=ppc2003 compatibility;Password=<enterStrongPasswordHere>;")

To encrypt an unencrypted SQL Server Compact 4.0 database, do the following:

C#

SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf");
engine.Compact("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;");

Visual Basic

Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;")
engine.Compact("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;")

Issue: Microsoft Visual C++ 2008 runtime libraries are required

The native DLLs of SQL Server Compact 4.0 need the Microsoft Visual C++ 2008 Runtime Libraries (x86, IA64, and x64), Service Pack 1.

Workaround
Install the .NET Framework 3.5 SP1. This also installs the Visual C++ 2008 Runtime Libraries SP1. You can download the libraries from the following location:

Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package ATL Security Update

Note that installing the .NET Framework 2.0, 3.0, or 4 does not install the Visual C++ 2008 Runtime Libraries SP1.

Issue: If SQL Server Compact is installed prior to installing .NET Framework on the machine then its provider invariant name is not registered in the .NET Framework machine.config file

SQL Server Compact can be installed on a machine that does not have .NET Framework installed because SQL Server Compact does not pre-requisite .NET framework. Due to this if none of the supported .NET Framework like 3.5 and 4 are available/installed prior to installing then the SQL Server Compact Setup does not register its provider invariant name in the machine.config file. Any application that relies on the SQL Server Compact entry in the machine.config file will fail. The invariant name registration entry in machine.config looks like this:

<system.data>
<DbProviderFactories>
    <remove invariant="System.Data.SqlServerCe.4.0"></remove>
    <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.4.0" Description=".NET Framework Data Provider for Microsoft SQL Server Compact"
     type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
  </DbProviderFactories>
</system.data>

Workaround
Uninstall SQL Server Compact 4.0 CTP1. Download and install the full versions of required .NET Framework versions from the following location:

Microsoft .NET Framework 3.5 Service pack 1 (Full Package)
Microsoft .NET Framework 4.0 Release (Full Package)

Then reinstall SQL Server Compact 4.0 CTP1.

Installing Applications

Issue: Installing an application can take a long time if the user's My Documents folder is redirected to a network share

Workaround
None. The application might take a while to install, but will install correctly.

Publishing Applications

Issue: Site might not work after publishing if the "Destination URL" field is not prefixed with http:// or https://

In the Publishing Settings dialog box, if the destination URL does not begin with http:// or https://, the site might not work after deployment.

Workaround
Make sure that before you publish a site, the destination URL in the Publish Settings dialog box starts with http:// or https://.

Issue: Publishing fails if the value for "Server" in "Publish Settings" contains a port number

Publishing to a server using a port number (for example, remote-server:8080) can fail if the server name is not prefixed with https://.

Workaround
Prefix the server name using https:// -- for example, https://remote-server:8080.

Issue: Application with standalone SQL Server Express .mdf file fails to publish.

Workaround
None. WebMatrix Beta is unable to publish standalone SQL Server Express .mdf files.

Issue: Publishing a MySQL database fails with the error "Failed to publish the database. This can happen if the remote database cannot run the script."

The error can occur for a number of reasons. One reason you can see this error is if the database script contains a single quotation character (') and the destination MySQL database's default character set is not to UTF-8.

Workaround
Set the default character set for the remote MySQL database to UTF-8.

Other Issues

Issue: No UI for setting editor font size in WebMatrix

In the Beta 2 release, there is no UI or gesture for setting font preferences for the editor.

Workaround
You can set a font size by launching WebMatrix from the command line and passing a switch that sets the size, as in this example:

webmatrix #executecommand# filtersite [website] #executecommand# editorfontsize [fontsize]

where [website] ir the name of the website to open and [fontsize] is the font size, as in this example:

webmatrix #executecommand# filtersite website1 #executecommand# editorfontsize 24

Issue: WCF applications fail to run with IIS Express

Browsing to a WCF application gives an error like this:

Could not load file or assembly'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

This is because IIS Express Beta doesn’t support WCF out of the box.

Workaround
You can fix this issue using any one of the following workarounds (workaround #2 requires Microsoft Windows Vista or higher):

  1. Copy the Microsoft.Web.dll and Microsoft.Web.Administration.dll assemblies from the WebMatrix installation location to the bin directory of the WCF application. By default, WebMatrix gets installed in the “Microsoft WebMatrix” folder under program files.

  2. On Microsoft Windows Vista or higher, create a symlink to the assemblies in the bin directory. This approach has the advantage of not doing an actual copy of the assemblies:

    mklink Microsoft.Web.Administration.dll "c:\Program Files (x86)\Microsoft WebMatrix\Microsoft.Web.Administration.dll"
    mklink Microsoft.Web.dll "c:\Program Files (x86)\Microsoft WebMatrix\Microsoft.Web.dll"
  3. 3. Install the two assemblies in the GAC. From an elevated prompt, run the commands:

    gacutil /i  "c:\Program Files (x86)\Microsoft WebMatrix\Microsoft.Web.Administration.dll"
    gacutil /i "c:\Program Files (x86)\Microsoft WebMatrix\Microsoft.Web.dll"

Issue: WebMatrix Beta 2 is unable to perform certain tasks that require elevation

WebMatrix Beta 2 is unable to perform certain tasks that require elevation, such as installing additional components in two situations:

  1. On Windows Vista or Windows 7, you are logged in with an account that does not have administrative privileges and User Account Control (UAC) is disabled.
  2. You are using Microsoft Windows XP or Microsoft Windows Server 2003.

Workaround
Most tasks in WebMatrix Beta 2 do not require administrative permission. For those that do, you can perform the operation as an administrator, or follow the operating system specific steps below.

  • On Windows Vista or Windows 7, enable UAC.
  • On Windows XP, add the user to the Administrators security group.

Issue: "Site from Web Gallery" is disabled

The Site from Web Gallery option is disabled if the Web Platform Installer 3.0 is not installed.

Workaround
Install the Microsoft Web Platform Installer 3.0.

Issue: On Windows Server 2003, IIS Express does not start for a non-administrative user

On Windows Server 2003, when you launch a page or start IIS Express, IIS Express does not start. For pages, an error is displayed that indicates that the application has been started by a non-administrative user.

Workaround
Start WebMatrix Beta 2 as an administrative user. For more details, see the following KnowledgeBase article:

An application that is started by a non-administrative user cannot listen to the HTTP traffic of the computer on which the application is running in Windows Vista, Windows Server 2003, or Windows XP.

Issue: Google Chrome is not available as a Run option

Google Chrome is not displayed in the list of browsers under Run on the Home tab.

Workaround
Some versions of Google Chrome do not register themselves correctly with the Default Programs feature in Windows. As a workaround, start Google Chrome, click the Customize and control Google Chrome menu, click Options, and then click Make Google Chrome my default browser.

Issue: The "Foreign Key" dialog box doesn't allow entering a primary key

The Foreign Key dialog box does not allow you to enter the primary key name from the primary key table.

Workaround
This is intentional. You do not need to enter the name of the primary key from the primary key table.

Issue: The "Relationships" button is disabled

The Relationships button under the Table tab in the Databases workspace is disabled for SQL Server Compact databases.

Workaround
None. SQL Server Compact does not support relationships between tables.

Issue: Parameterized SQL queries throw exceptions

In SQL Server Compact 4.0, if you do not specify a data type such as SqlDbType or DbType for parameters in parameterized queries, an exception is thrown when the query runs.

Workaround
Explicitly set the data type for parameters such as SqlDbType or DbType. This is critical in the case of BLOB data types (image and ntext). Use code like the following:

C#

SqlCeEngine engine = new SqlCeEngine(connString);
engine.CreateDatabase();
engine.Dispose();
SqlCeConnection conn = new SqlCeConnection(connString);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128), blob ntext);";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);";
SqlCeParameter paramName = cmd.Parameters.Add("name", SqlDbType.NVarChar, 128);
SqlCeParameter paramBlob = cmd.Parameters.Add("blob", SqlDbType.NText);
paramName.Value = "Name1";
paramBlob.Value = "Name1".PadLeft(4001);
cmd.ExecuteNonQuery();

Visual Basic

Dim engine As SqlCeEngine = New SqlCeEngine(connString)
engine.CreateDatabase()
engine.Dispose()
Dim conn As SqlCeConnection = New SqlCeConnection(connString)
conn.Open()
Dim cmd As SqlCeCommand = conn.CreateCommand()
cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128), blob ntext);"
cmd.ExecuteNonQuery()
cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);"
Dim paramName As SqlCeParameter
Dim paramBlob As SqlCeParameterparamName = cmd.Parameters.Add("name", SqlDbType.NVarChar, 128)
paramName.Value = "Name1"
paramBlob = cmd.Parameters.Add("blob", SqlDbType.NText)
paramBlob.Value = "Name1".PadLeft(4001)
cmd.ExecuteNonQuery()

For More Information

For more information about WebMatrix Beta 2, see the following websites:

Submit article feedback

You must Log In to submit feedback.