Contents
Note This readme applies to the Beta 1 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 2 release, see the WebMatrix Beta Release 2 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, you use Microsoft Platform Installer 3.0 Beta. After you've installed the Web Platform Installer, you can use it to install WebMatrix Beta.
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
Known Issues
WebMatrix Beta Installation Issues
Issue: WebMatrix Beta 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 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
Issue: Disabling Request Validation
For the Beta release, you cannot disable request validation by including markup (such as an @ Page directive) in an individual CSHTML page. As a result, 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.
Workaround
Disable request validation for the entire website. To do this:
- In the root folder of the website, create a Web.config file. (In WebMatrix Beta, this file type is available if you click All in the Choose a File Type dialog box.)
- In the Web.config file, add the following highlighted element as a child of the <system.web> element.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0" />
</system.web>
</configuration>
Alternatively, you can disable request validation for an individual page by using the <location> element in the Web.config file and specifying the relative URL of the folder or page. Put an element like the following into the Web.config file:
<?xml version="1.0"?>
<configuration>
<location path="MyPages/MyPage.cshtml" >
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
</location>
<!-- Other configuration settings here. -->
</configuration>
(The .cshtml file is .vbhtml if you are using Visual Basic instead of C# in your ASP.NET Web pages.)
Important If you disable request validation, you must manually check user input to make sure that it does not contain potentially dangerous markup or script. For more information, see How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings.
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 Developer Express, but you experience it when you deploy your website to a hosting website.
Workaround
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
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. MicrosoftWebMatrix Beta 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
- 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
- In the root folder of the website, create or open a Web.config file. (In WebMatrix Beta, this file type is available if you click All in the Choose a File Type dialog box.)
- 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.
Issue: Using WAP or MVC and ASP.NET Web pages in the same application
ASP.NET Web pages (.cshtml or .vbhtml pages) are not recognized in an ASP.NET MVC application or in an ASP.NET Web application project.
Workaround
Change the base class from which the application derives. In the Global.asax file, change the following line:
public class MvcApplication : HttpApplication { ... }To this: public class MvcApplication : WebPageHttpApplication { ... }
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: Publishing fails if a relative path is specified for "FTP Site Root" in Publish Settings
Some FTP clients allow you to specify a relative path as well as a full path as the Site Root. WebMatrix Beta only allows you to specify a full path.
Workaround
Specify a full path for Site Root.
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: Publishing fails with the error "The process cannot access the file <filename> because it is being used by another process."
Sometimes applications hold locks on files, which prevents them from being published. This can happen if the application is currently in use; for example, if it is open in a browser on your development computer.
Workaround
- Close the browser.
- Close and reopen WebMatrix Beta.
- Click Publish.
Issue: Publish fails if many files are unchecked in the "Publish Preview" dialog box
The WebMatrix Beta Publish feature fails if a very large number of files are unselected in the Publish Preview dialog box. This is because the Web Deployment Tool version 1.1 does not support skipping a very large number of items during publishing.
Workaround
Unselect a smaller number of files in the Publish Preview dialog box.
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: Published application does not work correctly if database connection string contains "username" key
Valid database connection strings can contain username=someusername. WebMatrix Beta only supports User Id=someusername or Uid=someusername.
Workaround
Use User Id or Uid instead of username when specifying a database connection string.
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: 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 cannotfind the file specified.
This is because IISDeveloper 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. 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 is unable to perform certain tasks that require elevation
WebMatrix Beta is unable to perform certain tasks that require elevation, such as installing additional components in two situations:
- 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.
- You are using Microsoft Windows XP or Microsoft Windows Server 2003.
Workaround
Most tasks in WebMatrix Beta 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 Beta is not installed.
Workaround
Install the Microsoft Web Platform Installer 3.0 Beta.
Issue: On Windows Server 2003, IIS Developer Express does not start for a non-administrative user
On Windows Server 2003, when you launch a page or start IIS Developer Express, IIS Developer 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 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, see the following websites: