WebMatrix on IIS8 on Windows 2016

May 2, 2017

How to install Webmatrix on IIS8 using Windows Server 2016

 

1. You do not need to install anything relating to Webmatrix !

2. Install the IIS Server Role

image

Create a virtual folder and copy all the files / database and web.config in there.

image

PS :  You can’t run .cshtml in the root folder !

Because it has a forbidden handler settings for .cshtml extensions

image

Result will look like this :

image

 

3. Configure the IIS server for ASP.NET Razor

Optionally you can set the CLR 4.0 as 32 Bit integrated mode.

image

Select the Handler Mappings, next Advanced Settings and change the Application Pool from :

Default Application Pool to .NET v4.5

image

 

You don’t need to set ISAPI filters !!

image

And the Mapping handlers are already installed for .cshtml as well Smile

image

You are ready to test you webpage…

PS :  don’t forget to give READ / WRITE access to the Database folder location ! Winking smile

Success !!


MS SQL (CE) Compact Edition – Tools

July 1, 2014

There a lot of nice Tools and utilities around to work with MS SQL CE, apart from the Webmatrix interface

image

And of course don’t forget your Powershell !

Here is a shortlist :

SQL CE Schema Script Utility

http://exportsqlce.codeplex.com/

image

Also has commandline utils that can convert SQLCE to SQLite

Usage : (To script an entire database to SQLite format)

ExportSQLCE.exe [SQL CE Connection String] [output file location] [sqlite]

http://sqlcetoolbox.codeplex.com/

image

SQLCE Commandline tool

http://sqlcecmd.codeplex.com/

image

Bulk Insert Tool

http://sqlcebulkcopy.codeplex.com/

image

SQL CE Toolbox

http://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/

image

Query and Database Management Tools

MS SQL CE Analyzer

http://sqlcequery.codeplex.com/

image

CompactView

http://sourceforge.net/p/compactview/home/Home/

image

LinQPad : Supports SQL CE, SharePoint and SQLite, and moreMust have tool ++++

http://www.linqpad.net/

image

SQLite and SQL CE together in 1 GUI

image

Mini SQL Query : Supports SharePoint and SQLite

http://blog.bendsoft.com/2013/01/minisqlquery-with-sharepoint-connector-3-0/

http://blog.bendsoft.com/2013/01/minisqlquery-with-sharepoint-connector-3-0/

image

Open MS SQL Compact using the management Studio
Choose the correct Server Type !

image

Some issues in later versions of the SQL CE edition :

Just to add a brief update now that SQL CE 4.0 is out. SQL management studio 2008 does not support SQL CE 4.0.

There are some helpful tools at sqlcetoolbox.codeplex.com.

Also see social.msdn.microsoft.com/Forums/en-US/sqltools/thread/… and

weblogs.asp.net/scottgu/archive/2011/01/11/…


WebMatrix on IIS7

May 31, 2013

Migrating WebMatrix 3.0 to a Windows 2008r2 / IIS 7 combination is a different story than the 2003 / IIS 6 version.

Before you start it is best that you make sure all files and folders are straight below the main ROOT folder of your IIS. (WebMatrix Razor code does not like applications in subfolders !! Gives you a lot of headaches.)

1. Make Sure you first install DotNET 4.0 to use WebMatrix 3.0 on a Windows 2008r2 server.

2. Check that you have the .NET and ISAPI Filter and Extensions installed for the IIS role.

image

After the installation, run these commands, to register the ASP.NET 4.0 for IIS : This step is not needed for IIS 8

x64 -> %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

x86 -> %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –ir

image

And check the results in the Application Pool if ASP.NET is there.

image

Don’t forget to set the ASP.NET v4.0 Application pool to run x32 bit apps.

image

And check the setting Managed Pipeline Mode is set to INTEGRATED

3. Create a Virtual Directory to host your application.

Next right click the Folder and select Convert to Application.

image

This is important.

The settings inside the main web.config will otherwise cascade downwards. And all other config files will inherit the main site settings.

If they have settings of their own they will override the parent. Which is the case in your WebMatrix Razor Application !

4. Link the Application folder to the ASP.NET v4.0 Application Pool.

image

5. Test your application now.

Getting Errors ? See here for some obvious mistakes :

If needed, Adjust the variable paths, in the pages to point to your new Virtual directory on IIS.

Make use of the “~/” dynamic pointer. And add to each URL in the pages, the extension .cshtml in the code.

Test the SQLCE database connection. It you get an error like this :

Access to the database file is not allowed. [ 1914,File name = C:\Inetpub\wwwroot\App_Data\test.sdf,SeCreateFile ]

Check the permission on the folder ~\App_Data\ where the .sdf file resides, and change it the read/write.

Test the External Database connections if you have them as well. If you get errors, you need to check the Web.Config to see if you have the correct data source settings in there.

When you see this Error in “/” Application.

image

You might want to add the missing MIME settings for .cshtml

image

 

Success !


Access IIS Express from different computers

May 31, 2013

OOTB the WebMatrix runs on a local Computer only for development reasons.

Once the application is finished you need to publish it to a hosting provider.

On top of this, it allows only your localhost to access the Web Application Sad smile

How to overcome this :

4. steps to complete

1. Add row in applicationhost.config file. Located in the USER Directory (change IP and Port to your settings).

<binding protocol="http" bindingInformation="*:60485:10.0.0.1" />

IIS Express maintains a user-specific “applicationhost.config” file in the %userprofile%\documents\IISexpress\config” folder.

2. Run this command to give access to your IIS Express running on the server.

netsh http add urlacl url=http://10.0.0.1:60485/ user=everyone 

3. Run this command to give access to your IISExpress running using the Firewall rule for the spec. port.

netsh advfirewall firewall add rule name="IISExpressWeb" 
dir=in protocol=tcp localport=60485 profile=private
remoteip=localsubnet action=allow 

4. Next create a service to start the IIS Express automatically, using the SC.EXE command.

Or run it from an IIS intranet sever (see my other post on How To)

Keep in mind that this is not a MS supported method, and all risks are on your side.

Fun to try anyhow !


WebMatrix on IIS6

May 31, 2013

Running WebMatrix 3.0 on a local machine is OOTB functionality. But you want to move the application to an IIS server like a Windows 2003 / IIS 6 combination.

You need to do some configuration to get it running.

1. Make Sure you first install DotNET 4.0 to use WebMatrix 3.0 on a Windows 2003 server.

2. Create a new Virtual Directory on the IIS to copy the Razor application to.

image

3. Add the ISAPI Filter for the .cshtml extension.

1. open IIS

2. right click on my web site and choose properties

3. click on Home directory tab

4. click on Configuration button

5. click on “Insert..” button

6. write .cshtml and / or .vbhtml as extension and c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll as path

image

4. Test the MS SQL CE Database connections (should work out of the box?). If not then check the settings in the Web.config file. See if you have these settings correct :

</system.web>
<font color="#333333">    <system.data>
        <dbproviderfactories>
            ...
</dbproviderfactories>
    </system.data>
</font>

Test the Default.cshtml to see if you get a response in the Browser.

Getting Errors ? See here for some obvious mistakes :

If needed, Adjust the variable paths, in the pages to point to your new Virtual directory on IIS.

Make use of the “~/” dynamic pointer. And add to each URL in the pages, the extension .cshtml in the code.

Test the SQLCE database connection. It you get an error like this :

Access to the database file is not allowed. [ 1914,File name = C:\Inetpub\wwwroot\App_Data\test.sdf,SeCreateFile ]

Check the permission on the folder ~\App_Data\ where the .sdf file resides, and change it the read/write.

Test the External Database connections if you have them as well. If you get errors, you need to check the Web.Config to see if you have the correct data source settings in there.

Next I will write a post on how to get it to run on a Windows 8r2 / IIS 7 combination. Takes a bit more steps and understanding Winking smile

Enjoy !!