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


SharePoint – Computer HW & SW Inventory

May 14, 2013

For many years, up till now I was spoiled by an Exchange Forms solution build by … can’t remember who … to grab the Computer details over the network, and save this in Outlook / Exchange.

image

Now that Exchange forms are not available by default anymore in the newer releases. I had to switch over to SharePoint 2010.

So I converted this to a custom SharePoint List.

When opening you get a pop-up message if the IE settings are not set properly.

image

Once opened just press the Get Info button, when the PC / Server is online you see the button color appear green else it goes red.

You get all the needed info from the remote hosts.

image

I added some conditional formatting to highlight disk capacity thresholds in red.

Save it and then get the next one, no firewall issues.

image

Our data is saved in a hosted SharePoint in the cloud, so I can access all the information easily even on my mobile device.

So migrating my old school tool made my life quite easy !


AD Tools Available to help you debug Issues

May 14, 2013

ntdsutil.exe
Use for command-line maintenance of your Active Directory database. Installed by default on domain controllers and menu driven.
Although many of its functions are also available via the GUI, it’s worth becoming familiar with this tool as sometimes nothing else will do.
For example, it’s needed for cleaning up if a domain controller isn’t demoted cleanly.

dcdiag.exe
Command-line tool to perform various domain controller tests to help confirm health and diagnose problems.
Part of the Support Tools suite (2000/2003) or included by default in Windows 2008.

netdiag.exe
For network-related tests and troubleshooting. Part of the Support Tools suite (2000/2003) or included by default in Windows 2008.

repadmin.exe & replmon.exe
Command-line tool to monitor and troubleshoot replication issues (repadmin.exe) and a GUI version that provides much of the same functionality (replmon.exe).

Part of the Support Tools suite (2000/2003)
or included by default in Windows 2008 (replmon is no longer provided).

ntfrsutl.exe
Accesses information on the ntfrs service including subscription information etc. Part of the Support Tools suite (2000/2003)
or included by default in Windows 2008.

Sonar
A graphical tool to monitor the status of the File Replication Service. Look for it on the Microsoft Download Center.

ADSI Edit
Low level editor for Active Directory. Installed as part of the Support Tools for Windows Server 2000 and 2003,
and installed by default when you install Active Directory on Windows Server 2008.

Group Policy Management Console (GPMC)
It’s been around for a while but you need to download it separately on 2003 (it’s included in 2008).
An improvement on the built-in group policy editor, you need at least 2003 server or XP SP1 to run it. Download it from Microsoft.

dsadd, dsget, dsmod, dsmove, dsquery, dsrm
Built-in command-line tools included with 2003 and 2008, use /? after the command for syntax.

csvde & ldifde
Built-in command-line tools included with 2000 and above, csvde is particularly useful for dumping the contents of Active Directory into a csv file,
or creating new objects from a similar file. Again, use /? after the command for help.

ADModify
Created to make it easier to do bulk operations on Active Directory objects, such as modifications, imports and exports.
Requires .NET framework installed (version 2 probably). It’s currently travelling the internet
so download from http://ADModify.NET and check the Microsoft Exchange Team Blog for an introduction.

redirusr.exe and redircmp.exe
Built-in command-line tools included with Windows 2003 and above. Change the default containers for new user and computer objects respectively.

ALTools.exe
Contains tools that assist you in managing accounts and in troubleshooting account lockouts.
Use these tools in conjunction with the Account Passwords and Policies white paper.

ALTools.exe includes:

AcctInfo.dll
Helps isolate and troubleshoot account lockouts and to change a user’s password on a domain controller in that user’s site.
It works by adding new property pages to user objects in the Active Directory Users and Computers Microsoft Management Console (MMC).

ALockout.dll
On the client computer, helps determine a process or application that is sending wrong credentials.

Caution: Do not use this tool on servers that host network applications or services. Also, you should not use ALockout.dll on Exchange servers, because it may prevent the Exchange store from starting.
ALoInfo.exe. Displays all user account names and the age of their passwords.

EnableKerbLog.vbs
Used as a startup script, allows Kerberos to log on to all your clients that run Windows 2000 and later.

EventCombMT.exe
Gathers specific events from event logs of several different machines to one central location.

LockoutStatus.exe
Determines all the domain controllers that are involved in a lockout of a user in order to assist in gathering the logs.
LockoutStatus.exe uses the NLParse.exe tool to parse Netlogon logs for specific Netlogon return status codes.
It directs the output to a comma-separated value (.csv) file that you can sort further, if needed.