.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘Windows’

A 0xC0AA0007 error is returned when an application uses IMAPI v2 to burn some data to a recordable disc on a computer that is running Windows Vista or Windows Server 2008

Symptoms
Assume that an application uses Image Mastering API version 2.0 (IMAPI v2) to burn some data onto a recordable DVD or CD on a computer that is running Windows Vista or Windows Server 2008. However, a 0xC0AA0007 error is returned.
This problem typically occurs with backup applications that use IMAPI v2. For example, this problem occurs when you try to create a system repair disc by using the Backup and Restore tool in the operating system. The job fails and you receive the following error message:

Fail to create system repair disc. (0xC0AA0007)
Resolution
In certain scenarios, the time that a device takes to close a session on a disc exceeds the time-out value in IMAPI. This behavior causes the image verification to fail. This hotfix increases the time-out value.

“Type Mismatch” error message when you run a VBA macro in a 64-bit version of an Office 2010 application

Symptoms
Assume that you have a Microsoft Visual Basic for Applications (VBA) macro that runs correctly on a 32-bit version of a Microsoft Office application. However, this VBA macro does not run correctly in a 64-bit version of?a Microsoft Office 2010 application in a 64-bit version ofWindows.
Typically, this problem occurs when the VBA macro uses some Microsoft ActiveX Data Objects (ADO) APIs that are platform-dependent.?For example, you run a VBA macro that uses the RecordCount property of an ADO Recordset object in a way that resembles the following:

Dim rs as ADODB.Recordse
LONG recordCount

recordCount = rs.RecordCountIn this example, you receive a “Type Mismatch” error message when you run this macro on a 64-bit version of an Office 2010 application.
NotesYou can install the 64-bit version of Office 2010 in the following Windows operating systems:64-biteditions of Windows Server 2003 Service Pack 2 that haveMSXML 6.0 installedx64-based editions of Windows Vista Service Pack 1 and later versions64-biteditions of Windows Server 2008 and later versionsx64-based editions of Windows 7Windows Server 2008 R2?To view a list of ADO APIs that are platform dependent,?see the “More information” section.
Resolution
Some ADO APIs are platform dependent in ADO 2.7 and later versions. On 64-bit versions of?Windows, these ADO APIs process arguments by using a 64-bit data type (such as the LONGLONG data type). However, applications that use these APIs still use the LONG data type. Therefore, you receive a “Type Mismatch” error message when you try to run the macro.

What Are Fatal Exception Errors

Symptoms
When you attempt to shut down your computer, start Windows, or start a program in Windows, you may encounter error messages that are similar to:

A fatal exception XY has occurred at xxxx:xxxxxxxx Fatal exception errors are codes that are returned by a program in the following cases: Access to an illegal instruction has been encountered Invalid data or code has been accessed The privilege level of an operation is invalid When any of these cases occurs, the processor returns an exception to the operating system, which in turn is handled as a fatal exception error. In many cases the exception is non-recoverable and the system must either be restarted or shut down, depending upon the severity of the error.
In the sample error message that is listed above, XY represents the actual processor exception from 00 to 0F. (Note that the “h” that is listed after the 0E, 0F, and so on, in the explanations below is frequently omitted from the error message.) The xxxx:xxxxxxxx value represents the enhanced instruction pointer to the code segment; the 32-bit address is the actual address where the exception occurred.
Windows does not cause these errors, but has the exception-handling routine for that particular processor exception, which displays the error message.
NOTE: This article is primarily for informational use. Click the following link to go to the “Troubleshooting Fatal Exception Errors” section of this article:

How to enable SQL Server connectivity on Windows XP Service Pack 2

Symptoms
This article describes how to enable SQL Server connectivity on Windows XP Service Pack 2.
By default, Windows Firewall is enabled on computers that are running Microsoft Windows XP Service Pack 2. Windows Firewall closes ports such as 445 that are used for file and printer sharing to prevent Internet computers from connecting to file and print shares on your computer or to other resources. When SQL Server is configured to listen for incoming client connections by using named pipes over a NetBIOS session, SQL Server communicates over TCP ports and these ports must be open. SQL Server clients that are trying to connect to SQL Server will be not be able to connect until SQL Server is set as an exception in Windows Firewall. To set SQL Server as an exception in Windows Firewall, use the steps that are listed in the “More Information” section.
Resolution
Create an exception for each instance of SQL Server The following method will open User Datagram Protocol (UDP) port 1434 in addition to the Transmission Control Protocol (TCP) port. If you want to open these ports manually, see the following article in the Microsoft Knowledge Base:
841252?(http://support.microsoft.com/kb/841252/) How to manually enable TCP/IP on Windows XP Service Pack 2 for SQL Server 2000
Note If you are running multiple instances of SQL Server, you will have to create an exception for each instance. Click Start, and then click Run. In the Run dialog box, type Firewall.cpl, and then click OK.In the Windows Firewall dialog box, click Add a Program on the Exceptions tab.In the Add Program dialog box, you can select an instance of SQL Server or you can click the Browse button to locate the instance of SQL Server that you want to add to the exception list. The default installation locations for SQL Server are listed in the following table.

Collapse this tableExpand this table
VersionFile pathSQL Server 7.0 Mssql\Binn\Sqlservr.exeSQL Server 2000 Default InstanceProgram Files\Microsoft SQL Server\Mssql\Binn\Sqlservr.exeSQL Server 2000 Named InstanceProgram Files\Microsoft SQL Server\Mssql$instancename\Binn\Sqlservr.exeSQL Server 2005 Default InstanceProgram Files\Microsoft SQL Server\MSSQL.x\MSSQL\Binn\sqlservr.exeSQL Server 2005 Named InstanceProgram Files\Microsoft SQL Server\MSSQL.x\MSSQL\Binn\sqlservr.exe
Note Each SQL Server 2005 instance is made up of a distinct set of services with specific settings for collations and other options. The directory structure, registry structure, and service names all reflect the specific instance ID of the SQL Server instance that is created during SQL Server 2005 Setup. x is the instance ID of the SQL Server instance that is created during SQL Server 2005 Setup.Select the name of the instance, and then click OK.Under Programs and Services, select the check box that is next to the name you selected in step 6, and then click OK. How to use Multiprotocol Remote Procedure Call (RPC)If you are using Multiprotocol, you must perform the steps in the “Create an exception for each instance of SQL Server” section as well as open the correct TCP ports on Windows Firewall.How to run RPC over TCPWarning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.
To run RPC over TCP, follow these steps:Enable port 135 on Windows Firewall. To do this, follow these steps: Click Start, and then click Run.In the Run dialog box, type Firewall.cpl, and then click OK.On the Exceptions tab, click Add Port. In the Port number box, type 135, and then click the TCP button.In the Name box, type a name for the port such as MULTI, and then click OK.On the Exceptions tab, you will see the new service. To enable the port, click to select the check box next to your new service, and then click OK.Modify the \\HKLM\SOFTWARE\Policies\Microsoft\Windows NT\RPC registry key.
Note If you have just installed SQL Server, this registry key does not exist. You will have to create the key and set the value. To do this, follow these steps: Click Start, and then click Run.In the Run dialog box, type Regedit, and then click OK. This will start Registry Editor.Locate the \\HKLM\SOFTWARE\Policies\Microsoft\Windows NT\RPC Registry key.Set the RestrictRemoteClients key to 0. Quit Registry EditorRestart the computer that is running SQL Server.How to use RPC over Named PipesIf you are running RPC over Named Pipes, you must open port 445 on Windows Firewall. To do this, follow these steps: Click Start, and then click Run.In the Run dialog box, type Firewall.cpl, and then click OK.On the Exceptions tab, click Add Port. In the Port number box, type 445, and then click the TCP button.In the Name box, type a name for the port such as MULTI, and then click OK.On the Exceptions tab, you will see the new service. To enable the port, click to select the check box next to your new service, and then click OK.

How the Windows Firewall exception settings in the Group Policy administrative template work together with the Windows Firewall Control Panel program in Windows Vista

Symptoms
This article describes how the Windows Firewall exception settings in the Group Policy administrative template work together with the Windows Firewall Control Panel program in Windows Vista.
Resolution
Group Policy settingsYou can configure the Windows Firewall settings in the Group Policy administrative template and then apply the settings to a Windows Vista-based computer. The settings that you use to configure exceptions appear on the Exceptions tab in the Windows Firewall Control Panel program. When you enable a setting in the Group Policy administrative template, the setting generates an enabled firewall rule that has the “Allow” action. When you disable a setting, this action generates an enabled firewall rule that has the “Block” action.
Windows Firewall Control Panel program settingsIf you enable or disable an exception by using the settings in Group Policy, the check box for the exception entry is selected in the Windows Firewall Control Panel program. A selected check box indicates only that some action has been taken in that exception. The selection does not indicate what specific action is configured in the exception. The selected check box could indicate any of the following settings:Windows Firewall: Allow inbound file and printer sharing exception Windows Firewall: Allow inbound remote administration exception Windows Firewall: Allow inbound Remote Desktop exception Windows Firewall: Allow inbound UPnP framework exceptions Windows Firewall: Allow ICMP exceptions
Full exception settingsTo view the full exception settings, use the “Windows Firewall with Advanced Security” snap-in. This snap-in is available in the Administrative Tools folder.

FIX: A System.ArgumentException exception occurs when you try to create a Windows form that inherits from a Windows form that contains a dataset

Symptoms
When you try to create a Windows form that inherits from a Windows form that contains a dataset in Microsoft Visual Studio .NET 2003, you may receive the following exception error message:

An unhandled exception of type ‘System.ArgumentException’ occurred in system.data.dll
Additional information: Cannot add primary key constraint since primary key is already set for the table.
Resolution
If the dataset contains nested datatables, Visual Studio .NET incorrectly tries to add additional code to the inherited Windows form to enforce constraints on the inherited dataset. This code tries to add a constraint that already exists on the dataset. Therefore, the behavior that is mentioned in the “Symptoms” section occurs.