Monday, February 22, 2010

AJAX Control Toolkit and .NET 4.0

If you would like to build a .NET 4.0 web application with Visual Studio 2010, and you would like to build the AJAX Control Toolkit from its source with .NET 4.0 as well, you may run into a little problem. Even though you can build the AJAX Control Toolkit itself just fine, but when you build your web application, the compiler will give an error: "Inheritance security rules violated by type: 'AjaxControlToolkit.TabPanelDesigner'. Derived types must either match the security accessibility of the base type or be less accessible."

A quick solution to this problem is to add the following to the "AssemblyInfo.cs" file of the AJAX Control Toolkit project (not your own web application project):

[assembly: SecurityRules(SecurityRuleSet.Level1)]

Of course, at the beginning of this file, make sure that you have

using System.Security;

After you have made these changes, rebuild the AJAX Control Toolkit, and then your web application. Your web application should build fine.

Update: A later build of AJAX Control Toolkit now works with Visual Studio 2010 without modification.

MySQL .NET Connector and .NET 4.0

Whe building a .NET 4.0 application with MySQL .NET Connector 6.2.2, you may get an 0x80131515 error from the SGEN utility, saying that the operation is not supported.

Apparently Visual Studio 2010 does not like the fact that the MySQL DLLs are pulled from the global assembly cache (GAC). If you add file references to these MySQL DLLs in your project, everything works.

To remove MySQL .NET Connector 6.2.2 from the GAC, you have to uninstall it. That is right: you have to uninstall it to use it!

After you uninstall MySQL .NET Connector 6.2.2 from the control panel, you can unzip the MySQL .NET Connector 6.2.2 zip file that you download from MySQL, and then place the files at a location that you can reference from your project.

Add references to these files in your project by browsing to them, you can then build your project with .NET 4.0 without errors.


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.