.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 ‘Web’

Error message when you try to restore a Windows SharePoint Services 3.0 Web site: “The site collection could not be restored. Please make sure the content databases are available and have suffici …

Symptoms
When you use the Stsadm.exe command-line tool to try to restore aMicrosoft Windows SharePoint Services 3.0 Web site on a computer that is runningWindows SharePoint Services 3.0, you receive the following error message:

The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space.
Resolution
This issue occurs if the computer that is running Windows SharePoint Services has insufficient free disk space that is available to host the restored Windows SharePoint Services Web site.This issue may also occur if the Windows SharePoint Services database has reached its maximum allowed size.

BUG: You receive a “The operation has timed-out” error message when you access a Web service or when you use the IPAddress class

Symptoms
In Microsoft Visual Studio .NET 2003, when you try to add a Web reference to a Web service, or when you call a Web service method, you may receive the following error message:

There was an error downloading ‘http://WebServerName/WebServicePath/WebServiceName’. The operation has timed-out.
Note WebServerName is a placeholder for the name of your Web server, WebServicePath is a placeholder for the path of the Web service, and WebServiceName is the name of the Web service.
In addition, when you use the IPAddress class, you may receive a “System.TypeInitializationException” exception. For example, when you use the Web Service Description Language tool (Wsdl.exe) to try to create a Web service proxy file, you may receive the following error message:

Unhandled Exception: System.TypeInitializationException: The type initializer for “System.Net.Sockets.Socket” threw an exception. —> System.Net.Sockets.SocketException: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full at System.Net.Sockets.Socket.InitializeSockets() at System.Net.Sockets.Socket..cctor()
Note You do not receive the previous error messages when you use Microsoft .NET Framework v1.0.
Resolution
When you install a protocol or a network adapter on your computer, the operating system creates a protocol binding between the network adapters and the protocols that are installed on your computer. Typically, a computer can store up to 50 protocol binding details. Therefore, if the number of protocol bindings exceeds 50, and you use the IPAddress class directly or indirectly (such as when you try to add a Web reference or when you call a Web service method), you receive the error messages that are mentioned in the “Symptoms” section of this article.
NotesThe operating system creates a protocol binding even for “phantom” (“ghosted”) adapters on your computer.
For additional information about phantom devices, click the following article number to view the article in the Microsoft Knowledge Base:
241257?(http://support.microsoft.com/kb/241257/) Device Manager Does Not Display Devices Not Currently Present in Windows 2000To determine the number of protocol bindings on your computer, run the enum.exe file.
The following file is available for download from the Microsoft Download Center:

Collapse this imageExpand this image
Download the enum.exe package now.(http://download.microsoft.com/download/9/3/0/930e1ecb-a6c6-445f-bd79-82fc3e66f009/enum.exe) For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591?(http://support.microsoft.com/kb/119591/) How to Obtain Microsoft Support Files from Online Services Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

BUG: IWAM Account Is Not Granted the Impersonate Privilege for ASP.NET 1.1 on a Windows 2000 Domain Controller with SP4

Symptoms
When you install ASP.NET 1.1 on a computer running on a Windows 2000 Server domain controller with Service Pack 4 (SP4) installed, the IWAM account is not granted impersonate user rights for ASP.NET 1.1. When you request an ASP.NET 1.1 page, you may receive the following error message:

Server Error in ‘/iwamtest’ Application.
Access is denied.
Description An unhandled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details System.ApplicationException: Access is denied.
Source Error
An unhandled exception was generated during the execution of the current Web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace
[ApplicationException: Access is denied. ]

System.Security.Principal.WindowsIdentity._ResolveIdentity(IntPtr userToken) +0 System.Security.Principal.WindowsIdentity.get_Name() +71 System.Web.Configuration.AuthorizationConfigRule.IsUserAllowed(IPrincipal user, String verb) +100 System.Web.Configuration.AuthorizationConfig.IsUserAllowed(IPrincipal user, String verb) +81 System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +178 System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
Resolution
You may experience the behavior when the user account that you use to run the program does not have the Impersonate a client after authentication user right(the SeImpersonatePrivilege function). When you upgrade Windows 2000 Server Domain Controller to SP4, the user account (IWAM) is not grantedSeImpersonatePrivilege, and then programs that use impersonation may not work correctly.

BUG: “Unhandled exception in EXENAME.EXE(OLE32.DLL): 0xC0000005: Access Violation” when you use an ATL Composite control on computers without Visual C++ installed

Symptoms
When you create an ATL Composite control with other ActiveX controls embedded in it, you may get an access violation in Ole32.dll. Usually, a message box is displayed with the following error message:

Unhandled exception in EXENAME.EXE(OLE32.DLL): 0xC0000005: Access ViolationYou may also see a Web Browser control displayed with the following message, instead of the child ActiveX control:
This page cannot be displayed. Usually, these controls work correctly on computers with Visual C++ installed, but they do not work on computers without Visual C++ installed.
Resolution
The ActiveX controls embedded in the Composite control may be licensed controls. Composite controls and ATL containment do not directly support creation of licensed controls.
When the Composite control attempts to create a licensed control on a computer without providing a run-time license, the Composite control fails with an HRESULT of 0×80040112 (CLASS_E_NOTLICENSED – Class is not licensed for use). The default handling of this failure creates a Web Browser control; the default handling also tries to initialize the Web Browser control with persisted properties of the licensed control. This mismatch of properties may result in an access violation in the Ole32.dll file.
If there is no access violation, the Web Browser control attempts to navigate to a URL that is the string representation of the licensed control’s CLSID. This action results in the error message “The page cannot be displayed.”

BUG: “Cannot implicitly convert type ‘System.Data.DataSet’” error when application is built

Symptoms
You have a Web Service that has a Web Service method that returns an instance of a custom class. The class that is returned by the Web Service method implements the IXmlSerializable interface. If you use this Web Service in an application, you may receive the following error message when you build the application:

Cannot implicitly convert type ‘System.Data.DataSet’ to ‘ClassLibrary.ClassName’
Resolution
When you add a Web reference to a Web Service, Microsoft Visual Studio .NET incorrectly uses System.Data.DataSet instead of the class that implements the IXmlSerializable interface. Therefore, the Web Service method in the proxy class returns System.Data.DataSet instead of the custom class that implements the IXmlSerializable interface. Therefore, you receive the error message when you consume the Web Service method in your Web application.

Authentication may fail with “401.3″ Error if Web site’s “Host Header” differs from server’s NetBIOS name

Symptoms
When you are using Internet Explorer on a Windows 2000 or later client and browsing to a Web site where the host header name is different from the NetBIOS name of the computer, Integrated Authentication may fail with an HTTP error 401.1, error 401.2, orerror 401.3.
NoteInternet Explorer clients that are using Windows NT 4 or Windows 95 or Windows 98 will not fail. Also, other authentication schemes will work.
Microsoft ASP.NET users may see an error message that is similar to the following:

Server Error in ‘<application name>’ Application.
Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’.
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’.
Resolution
During Kerberos authentication, a domain controller that is running Windows 2000 or Windows Server 2003grants tickets based on the Server Principle Name (SPN) of the Internet Information Services (IIS) Web server.If the host header (Web site name) being requested differs from the NetBIOS name of the IIS 5.0 computer, Kerberos authentication will fail, causing 401.3 errors on the client.
Clients using Windows NT 4 or Windows 95 or Windows 98 succeed because they do not natively support Kerberos and thus use Windows NT Challenge/Response (NTLM) authentication.