Sunday, November 15, 2009

RibbonControls and Visual Studio 2010 Beta

When building an WCF project with Visual Studio 2010 that includes Microsoft Office UI's RibbonControls, the project may not build correctly, even though the same project may have been built correctly under Visual Studio 2008. The error is "Operation is not supported. (Exception HRESULT: 0x80131515)".

To fix this problem, first the file "RibbonControlsLibrary.dll" must be unblocked. Right click on this file in Windows Explorer, and then selec "Properties". On the "General" tab, there is an "Unblock" button near the bottem. Click on the button to unblock it.

Second, do no place "RibbonControlsLibrary.dll" in the GAC. If you have already placed it in the GAC, you will get an error saying that "This assembly is not vetted for safe use by partial trust code". Remove it from the GAC by running "gacutil -u RibbonControlsLibrary" from Windows command line. Then add a reference to the file "RibbonControlsLibrary.dll" in your project directly.

This should make your WPF project build under Windows 2010.

Wednesday, November 4, 2009

CRM 4.0 Email Router Uses Double Escape Sequence When Accessing Exchange Server

Somehow Microsoft's own programmers do not seem to know the behaviors of their own webs server. IIS by default rejects requests with double escape sequence in the request URL. As a result, CRM 4.0 Email Router service may generate a lot of errors in the server's event log when it uses double escape sequences, saying that it was unable to access certain mail boxes on the Exchange 2007 server that it trys to connect to. Oddly enough, tests from the CRM Email Router Configuration Manager succeed every time. But errors in the event log keeps piling up.

The fix is to turn off the IIS rejection of double escape sequence.

Microsoft actually has a knowledge base article that tells us exactly how this is done:

http://support.microsoft.com/kb/942076

Friday, October 16, 2009

A MS SQL Server 2008 Data Recovery Technique

I had some MS SQL Server 2008 database files that became corrupted recently. The files were detached from the SQL Server before they became corrupted. So when I tried to attach them, I get errors saying that the SQL server failed on some assertion at location "logmgr.cpp": 4217. The asserted expression was "lfh->lfh_startOffset == startOffset".

After many many different attempts, I finally got the files to attach. The steps that I took are things most people would normally try, but I added a twist to the first step:

1. Create a new blank database with the same name and schema: tables, constraint, etc. At this point you may have guessed what should follow. But before you go on, do the following: set it into emergency and single mode.

ALTER DATABASE CorruptedDB SET EMERGENCY
GO
ALTER DATABASE CorruptedDB SET SINGLE_USER;
GO

2. The rest of the steps are fairly typical. Stop the SQL Server service from the SQL Server Configuration Manager.
3. Replace the files for this blank database with the corrupted files.
4. Restart the SQL Server service from the SQL Server Configuration Manager.

This allowed me to access a set of database files that were otherwise no longer readable. Although I could not even look at the table definitions in the SQL Server Management Studio, I could selelct all the data rows out of it, and insert into a new database with the same schema:

USE
SET IDENTITY_INSERT ON
INSERT INTO .[dbo].
(
,...

SELECT
,...

FROM CorruptedDB.[dbo].
GO
SET IDENTITY_INSERT OFF
GO


Sunday, October 4, 2009

Microsoft CRM 4.0 IFD Requires SQL Server Report Service

This does not seem obvious, but if the Report Service of your SQL Server is not running, the users of Microsoft CRM 4.0 cannot login via the Internet, although intranet login would still work.

Apparently the Internet Facing Deployment (IFD) of Microsoft CRM 4.0 depends on the Report Service of Microsoft SQL Server.

Also in Microsoft CRM's "Deployment Manager", select "Servers" in the left pane, you will see a list of servers in the right pane. Make sure that the server for the "Full Server" roll is enabled. Otherwise, IFD would not work, either.

Sunday, September 27, 2009

Sharepoint Configuration Wizard's "CREATE DATABASE permission denied" Error

When creating a new Sharepoint website with the "Sharepoint Products and Technology Configuration Wizard", you may get the error "CREATE DATABASE permission denied in database 'master'."

You may then recall that earlier in this wizard you were prompted to enter a set of SQL Server login credentials to be used. You may then think that it was because this SQL Server login does not have the permission to create a new database. You give this login all of the SQL Server administrative rights, and you may still get the same error.

Here the problem is that when creating the new database, this Wizard does not use the credential that you provided, instead it uses the Windows login credentials that you used to log into Windows to run the Wizard itself.

So you need to make sure that whatever Windows login that you used to get into Windows to run this Wizard, say "yourdomain\yourlogin", then "yourdomain\yourlogin" must be a valid login for the SQL Server in question as well, and it must have the permission to create a new database. The login that you entered in the Wizard itself is not even used during the creation of this new database.

Sunday, September 6, 2009

Fix for Outlook 2007 Not Showing Contacts in Addressbook

After migrating a Windows user to a Vista machine, I noticed that none of the contacts in the Outlook contact folder are showing in the address book. When sending an email, email addresses have to be typed in. When I went to the "Properties" of the Outlook Contacts folder to setup the address book, the check box for "Show this folder as an e-mail Address Book" was unchecked and grayed out. There is no way to check it.

The fix is simple: use a new Outlook profile. Exit Outlook, and go to Windows' Control Panel, and go to "Mail". If you are using 64 bit Windows, you will need to go to the 32 bit Control Panel to find "Mail" because Microsoft Office 2007 applications are 32 bit.

Click on the "Show Profiles..." button, and then click "Add...". You will need to re-enter your email server account information all over again here. Once you finish creating the new profile, select it from the drop down list for "Always use this profile".

Because I use Exchange Server inbox to store mail, all my mail messages are available from the new profile automatically. You can always open old mail stores from the "File", "Open", "Outlook Data File..." menu in Outlook, and keep it open, or move old messages into the new mail stores


Microsoft Outlook Anywhere Setup

When setting up Outlook Anywhere in Exchange Server 2007, all the steps described in "Exchange Server 2007 End-to-End Scenario" are not enough. You need to run the following command in the Exchange Management Shell:

Get-AutodiscoverVirtualDirectory set-AutodiscoverVirtualDirectory-ExternalURL https:// your-iis-server.yourdomain.com /AutoDiscover/Autodiscover.xml

Here "your-iis-server" is the IIS server name where you have your Exchange "AutoDiscover" Web application hosted. Besides this extra step, all the steps described in "Exchange Server 2007 End-to-End Scenario" must be followed exactly. You can get to "Exchange Server 2007 End-to-End Scenario" by clicking on the root node in the left pane of the "Exchange Management Console". The "End-to-End Scenario" is on the second tab.

On the client side, as long as your local LAN setup works, you can leave it alone, even if you use domain names that are not publicly accessible since virtual RPC over HTTPS will take care of that automatically. All you need to do is to check the "Connect to Microsoft Exchange using HTTP", and setup "Exchange Proxy Settings". This is located in the email account setup dialog box. Click on "More Settings...", and then go to the "Connection" tab. Outlook Anywhere settings is at the bottom of this tab. Your Exchange server IIS external URL should be entered in the "Exchange Proxy Settings" dialog box as the proxy server URL.One thing you should do is to keep all your authentication protocol consistent. If you choose to use NTLM, use it at every step. Otherwise use "Basic Authentication" everywhere.

Microsoft Exchange Server 2007 and Microsoft CRM 4

Microsoft Exchange Server 2007 uses security certificates for client connections. This complicates the situation for Microsoft CRM 4.0 Email Router that needs to access the Exchange Server to route emails.

Microsoft CRM 4.0 Email Router is very buggy. One of the problem is that you can give it an HTTPS Exchange server address, it will try to use HTTP to access user email inboxes regardless. This will cause the access to the Exchange Server to fail.

One remedy is to use IIS 7.0 URL Rewrite Module to redirect all HTTP traffic to HTTPS. When you do this, you have to make HTTPS as "NOT REQUIRED" in IIS. This way the Rewrite Module will actually get a chance to redirect the traffic. The net effect is virtually the same as requiring HTTPS, since no meaningful responses are sent via HTTP.