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 !!


ASP.Net Error [im003] – Oracle Error

October 8, 2014

Error [im003] specified driver could not be loaded due to system error  5 (oracle in oracle9i)

I had a strange error when accessing an Oracle database over ODBC using an ASP.NET (4.0 framework) Application running on IIS 6.0.

The ASP.net page could not load the database tables while the ODBC manager gave no errors ?

image

In the eventviewer I saw a lot of ASP.NET 4.0.30319.0 – Event ID 1309

image

This showed definitely a security issue on the Oracle home directory.

image

Solution :

Oracle 9.2 Client software requires that you give the Authenticated User privilege to the Oracle Home by following these steps:

1. Log on to Windows as a user with Administrator privileges.

2. Launch Windows Explorer from the Start Menu and and navigate to the ORACLE_HOME folder. This is typically the “Ora92” folder under the “Oracle” folder (i.e. C:\Oracle\Ora92).

3. Right-click on the ORACLE_HOME folder and choose the “Properties” option from the drop down list. A “Properties” window should appear.

4. Click on the “Security” tab of the “Properties” window.

5. Click on “Authenticated Users” item in the “Name” list (on Windows XP the “Name” list is called “Group or user names”).

6. Clear the “Read and Execute” box in the “Permissions” list under the “Allow” column (on Windows XP the “Permissions” list is called “Permissions for Authenticated Users”).

7. Re-check the “Read and Execute” box under the “Allow” column (this is the box you just unchecked).

8. Click the “Advanced” button and in the “Permission Entries” list make sure you see the “Authenticated Users” listed there with:

·

Permission = Read & Execute

·

Apply To = This folder, subfolders and files

If this is NOT the case, edit that line and make sure the “Apply onto” drop-down box is set to “This folder, subfolders and files”. This should already be set properly but it is important that you verify this.

9. Click the “OK” button until you close out all of the security properties windows. The cursor may present the hour glass for a few seconds as it applies the permissions you just changed to all subfolders and files.

10. Reboot your computer to assure that these changes have taken effect. (no need for this in my case).

11. Re-execute the application and it should now work.

This made it works like a charm !

Reason was that IIS user did not have enough permission on the folders and subfolders ?


SSRS – Connect to an OLAP cube using XML/A

September 16, 2014

While there is native way in Report Builder 3.0 to connect to an MS SQL OLAP Cube.

I wan’t to demonstrate an alternative way to connect to ANY kind of OLAP cube that supports XML/A.

For MS SQL you first need to configure your OLAP Analisys Services to be able to connect using XML/A protocol.

For Windows Server 2003 look here for Windows Server 2008 look here

Make sure you have the IIS Application Pool settings set to be 32Bit compatible.

image

Once you have it running you can connect SSRS using the msmdpump.dll

Like this :

http://YourServer/olap/msmdpump.dll

You can use multiple XML/A compatible clients like for example Kettle Spoon.

image

Where you can enter your MDX query and test it.

As well as just plain MS Excel to connect to the OLAP Cube using XML/A connection

image

Or even PowerPivot as a client to connect.

image

But back to SSRS, it goes like this. Choose SQL Analysis Server, and point the to the XML/A URL as connection string.

image

And you can access the Dimensions using regular MDX Queries.

image

Bonus:

Apart from the fact that you access multiple OLAP Cube brands like for example the In-Memory IcCube

image

image

And using Multiple Clients – see above.

It comes also is also is not blocked by the firewall since XML/A uses the HTML (80) or SHTML (443) port.

Enjoy !


Monitor the IIS logon Sessions and more …

August 29, 2014

I find it very hard to monitor who is logged on the which session in Windows.

Using the Event Viewer you get these Logon types possible:

 

Logon Type Description
2 Interactive (logon at keyboard and screen of system) Windows 2000 records Terminal Services logon as this type rather than Type 10.
3 Network (i.e. connection to shared folder on this computer from elsewhere on network or IIS logon – Never logged by 528 on W2k and forward. See event 540)
4 Batch (i.e. scheduled task)
5 Service (Service startup)
6 Unlock (i.e. unnattended workstation with password protected screen saver)
7 NetworkCleartext (Logon with credentials sent in the clear text. Most often indicates a logon to IIS with “basic authentication”) See this article for more information.
8 NewCredentials
10 RemoteInteractive (Terminal Services, Remote Desktop or Remote Assistance)
11 CachedInteractive (logon with cached domain credentials such as when logging on to a laptop when away from the network)

And even more difficult to monitor it for IIS using SharePoint.

Solution is given by the famous MS SysInternal Team.

http://technet.microsoft.com/en-us/sysinternals/bb896769

They created the tool LogOnSessions.exe –p

image

Exporting this to a text a log file using the > “C:\Temp\LogonSessions.log” parameter give you the data to be used for later treatment.

Or use Powershell Winking smile

CLS

$Cmd ="C:\Apps\MS SysInternal\logonsessions.exe"

$cmdOutput = & $Cmd 2>&1

# echo "--------"
# echo $cmdOutput
# $cmdOutput | Tee-Object -Variable scriptOutput | % { "processing Output : $_ " }
# echo "--------"
echo ""
echo "Number of Objects $($scriptOutput.Count) Too many let's filter :)"
echo ""

$cmdOutput | Tee-Object -Variable scriptOutput | % { $_} | `

    Where-object {$_ -like '*UPN*' `
    -and $_ -notlike  "*Administrator*" `
    -and $_ -notlike  "*spFarm*" `
    -and $_ -notlike "*SRV*"} `
        |  Sort-Object -descending | Get-Unique

Output looks like this giving you only the remote users Login Accounts  (UPN)Smile

image

Enjoy !


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 !!