Thursday, April 24, 2008

Referencing Namespace from Web.Config

Instead of making the code in .cs file complex you can also add all your name space in web.config. Harry Potter The name space referenced from web.config file will be available to all cs or vb files in the project. Every time writing the same name space again and again increases the LOC.


<configuration>
<system.web>
<pages>
<namespaces>
<add namespace=”System.Net.Mail”/>
</namespaces>
</pages>
</system.web>
</configuration>

Monday, April 14, 2008

Writing CLS comliant code

Hi Guys,

I know some of us guys think that the code we are writing is CLS compliant by default but actually it is not. For writing CLS compliant code we have to explicitly declare CLSAttribute="true"

Wednesday, April 9, 2008

Where Vs Having / Difference between having and Where clause

We always get confused between WHERE and Having clause and make mistakes. Here in this article, I will try to highlight all the major differences between WHERE and HAVING, and things you should be aware of, when using either WHERE or HAVING.

------------------------------------------------------------------------------

Most of the time you will get the same result with Where or Having . The below given two SQL command produces the same result set That is, both count the number of records found for the states of California and Los Angles.

SELECT state, COUNT(*)
FROM Test
WHERE state IN ('CA', 'LA')
GROUP BY state
ORDER BY state

SELECT state, COUNT(*)
FROM Test
GROUP BY state
HAVING state IN ('CA', 'LA')
ORDER BY state


So, where is the difference ,Which is better? I'll let you answer those questions in a minute.

The main reason for using WHERE clause is to select rows that are to be included in the query. For example, assume table Test.Suppose I want the names, account numbers, and balance due of all customers from California and Los Angles. Since STATE is one of the fields in the record format, I can use WHERE to select those customers.


SELECT cusnum, lstnam, init
FROM Test
WHERE state IN ('CA', 'LA')

CUSNUM LSTNAM INIT BALDUE
====== ============ ==== ========
938472 John G K 37.00
938485 Mark J A 3987.50
593029 Lily E D 25.00


Suppose I want the total amount due from customers by state. In that case, I would need to use the GROUP BY clause to build an aggregate query.

SELECT state,SUM(baldue)
FROM Test
GROUP by state
ORDER BY state

State Sum(Baldue)
===== ===========
CA 250.00
CO 58.75
GA 3987.50
MN 510.00
NY 589.50
TX 62.00
VT 439.00
WY .00



Suppose I want the same information, but I don't care about states where nobody owes me any money. Since the total owed by state is an aggregate figure, i.e., the figure is generated from a group of records, you must use HAVING to select the proper data.

SELECT state,SUM(baldue)
FROM Test
GROUP by state
HAVING SUM(baldue) > 0
ORDER BY state

State Sum(Baldue)
===== ===========
CA 250.00
CO 58.75
GA 3987.50
MN 510.00
NY 589.50
TX 62.00
VT 439.00



Here's the rule. If a condition refers to an aggregate function, put that condition in the HAVING clause. Otherwise, use the WHERE clause.

Here's another rule: You can't use HAVING unless you also use GROUP BY.

Now, go back to the first example, where WHERE and HAVING produce the same result set. What's the difference? The first query uses the WHERE clause to restrict the number of rows that the computer has to sum up. But the second query sums up all the rows in the table, then uses HAVING to discard the sums it calculated for all states except Texas and Georgia. The first query is obviously the better one, because there is no need to make the computer calculate sums and then throw them away.

I mentioned a tip that some of the more experienced readers may not have seen. Some queries combine aggregate processing with non-aggregate processing. In a classic example, one table contains individual sales, while another contains a quota for a sales rep. The first table contains more than one record per rep, and those records must be summarized in order to get an aggregate total, which is then compared to the sole quota record for a rep. How do we find the reps who have not met their quotas?

Like this:

SELECT rep, SUM(amount)
FROM sales AS a
GROUP by rep
HAVING SUM(a.amount) >=
(SELECT quota
FROM Test AS b
WHERE b.rep = a.rep)
ORDER BY rep

The first SELECT sums the individual sales by rep. Each rep's sum is compared to one record from the Test table, in order to determine if the aggregate sum is at least as much as the quota. As before, it's necessary to put the aggregate function (SUM) in the HAVING clause.

If these are the sales:

Rep Amount
=== ======
1 20
1 30
2 40
3 30
3 20

And these are the quotas:

Rep Quota
=== =====
1 70
2 30
3 40

This is the result:

Rep SUM(Sales)
=== ==========
2 40
3 50

Your comments are always welcome


kick it on DotNetKicks.com

Tuesday, April 8, 2008

Limit postbacks with ASP.NET client callbacks

Disconnected

Over the years, there have been various solutions that circumvent the stateless limitation of Web applications, with the focus on reducing the number of page calls or reloads to avoid hampering the user experience. For example, many developers used hidden frames to serve as data sources so data could easily be sent to or retrieved from the hidden frame page. Also, some developers chose to load everything with the initial load, so subsequent page loads are reduced.

The problem arises when it is absolutely necessary to make a server call. This is where the AJAX group of technologies enters the picture. AJAX utilizes the XMLHTTP object, along with XML and client side scripting (aka JavaScript) to handle asynchronous server calls.


ASP.NET model

The default behavior of an ASP.NET page begins when the page is requested by a user and loaded in the requesting client. The user interacts with the page via various actions like clicking a button. These actions may trigger a call to the server called a postback (i.e., the page is posted back to the host with a new version of the page reloaded as a result of the action).

Page postbacks come with a price. For example, client state may be lost, and communicating with the server interrupts the user experience as they wait during communication and page reload. AJAX methodologies address these issues by facilitating asynchronous communication with a server while the user experience is not interrupted. A similar approach may be implemented in ASP.NET 2.0 through the use of the ICallbackEventHandler interface.

Implementing a callback


A callback is a function associated with a specific user interface component. The callback performs a certain action in response to a component event. The event can be any one of the many available mouse clicks or any other event.

Implementing callbacks in an ASP.NET 2.0 page has a few differences from standard Web pages. The following list outlines the necessary changes to the page code:

The page must implement the ICallbackEventHandler interface.
The RaiseCallbackEvent method of the ICallbackEventHandler interface must be implemented by the page. This method is invoked to perform the callback on the server.
The page must implement the GetCallbackResult method of the ICallbackEventHandler interface. This method will return the callback result to the client.
With these code changes in place, the callback may be utilized on the client side of the page (HTML source). The Web page must include client-side functions to perform the actual server request along with receiving the results from the server request.

The C# page in the following code listing provides a demonstration of implementing a callback.

<%@ Page Language="C#" %>
<%@ Implements Interface="System.Web.UI.ICallbackEventHandler" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

ASP.NET Callback







Test

A few notes on the code:

The page’s Page_Load event sets a reference to the callback function (GetData) via the GetCallbackEventReference method available in the page’s ClientScript property. The method accepts these parameters: a reference to the page; the name of the argument by which the data are passed; the name of the client script function that receives the callback data; and an argument that passes any context you want. In this example, the context isn’t used.

The function that will be used to call the server is created (callbackScript variable in the example) with the function reference included. Also, the arguments that are accepted by the generated function must match the names passed to the GetCallbackEventReference method. Finally, the callback script is registered on the page via the RegisterClientScriptBlock method of the Page object’s ClientScript property.

The GetCallbackResult method provides the output (string) returned by the callback. In this example, the current date and time (on the server) is returned.

The client function that receives callbacks is loaded in the header portion of the page (GetData in the example). The function must be named to match the name passed in the call to the GetCallbackEventReference method. The function accepts two string values for the return value and an optional second value for the context value that is passed back from the server.
The button on the page is tied to the callback function. In this example, the HTML span object receives the callback result.

A smooth user experience

Avoiding page reloads simplifies the user experience and can reduce the amount of data sent back and forth between the client and server. You can use the AJAX approach to provide this functionality; you can also use ASP.NET 2.0’s callback support. The applications for these techniques are endless, and anything that improves the user experience is good for business.

I hope you liked this article..if yes please drop some comments

kick it on DotNetKicks.com

Monday, April 7, 2008

Top 10 new features in SQL Server 2005

1. T-SQL (Transaction SQL) enhancements

T-SQL is the native set-based RDBMS programming language offering high-performance data access. It now incorporates many new features including error handling via the TRY and CATCH paradigm, Common Table Expressions (CTEs), which return a record set in a statement, and the ability to shift columns to rows and vice versa with the PIVOT and UNPIVOT commands.

More information from Microsoft.



2. CLR (Common Language Runtime)
The next major enhancement in SQL Server 2005 is the integration of a .NET compliant language such as C#, ASP.NET or VB.NET to build objects (stored procedures, triggers, functions, etc.). This enables you to execute .NET code in the DBMS to take advantage of the .NET functionality. It is expected to replace extended stored procedures in the SQL Server 2000 environment as well as expand the traditional relational engine capabilities.


More information from Microsoft.



3. Service Broker
The Service Broker handles messaging between a sender and receiver in a loosely coupled manner. A message is sent, processed and responded to, completing the transaction. This greatly expands the capabilities of data-driven applications to meet workflow or custom business needs.


More information from Microsoft.



4. Data encryption
SQL Server 2000 had no documented or publicly supported functions to encrypt data in a table natively. Organizations had to rely on third-party products to address this need. SQL Server 2005 has native capabilities to support encryption of data stored in user-defined databases.


More information from Microsoft.


5. SMTP mail
Sending mail directly from SQL Server 2000 is possible, but challenging. With SQL Server 2005, Microsoft incorporates SMTP mail to improve the native mail capabilities. Say "see-ya" to Outlook on SQL Server!


More information from Microsoft.


6. HTTP endpoints
You can easily create HTTP endpoints via a simple T-SQL statement exposing an object that can be accessed over the Internet. This allows a simple object to be called across the Internet for the needed data.



More information from Microsoft.


7. Multiple Active Result Sets (MARS)
MARS allow a persistent database connection from a single client to have more than one active request per connection. This should be a major performance improvement, allowing developers to give users new capabilities when working with SQL Server. For example, it allows multiple searches, or a search and data entry. The bottom line is that one client connection can have multiple active processes simultaneously.


More information from Microsoft.
.


8. Dedicated administrator connection
If all else fails, stop the SQL Server service or push the power button. That mentality is finished with the dedicated administrator connection. This functionality will allow a DBA to make a single diagnostic connection to SQL Server even if the server is having an issue.



More information from Microsoft.


9. SQL Server Integration Services (SSIS)
SSIS has replaced DTS (Data Transformation Services) as the primary ETL (Extraction, Transformation and Loading) tool and ships with SQL Server free of charge. This tool, completely rewritten since SQL Server 2000, now has a great deal of flexibility to address complex data movement.



More information from Microsoft.


10. Database mirroring
It's not expected to be released with SQL Server 2005 at the RTM in November, but I think this feature has great potential. Database mirroring is an extension of the native high-availability capabilities. So, stay tuned for more details…. For now, here's



More information from Microsoft.






I hope you liked this article..if yes please drop some comments

kick it on DotNetKicks.com

Friday, April 4, 2008

Ajax Update Panel

In this article, I am going to explain how we can auto refresh data on an ASP.NET page after a certain interval using AJAX UpdatePanel and other controls (assuming you have some basic knowledge of AJAX Toolkit). I am using some Ajax controls and using SQL server database and Data Grid control. Lets for the time, use database north wind and set our interval time for refreshing data as 30 seconds.




Code behind page :

public void BindData()
{
con = new SqlConnection("Initial Catalog=Northwind; Data Source=localhost; Uid=sa; pwd=;");
cmd.CommandText = "select * from Employees ";
cmd.Connection = con;
con.Open();
da = new SqlDataAdapter(cmd);
da.Fill(ds);
cmd.ExecuteNonQuery();
GridData.DataSource = ds;
GridData.DataBind();
}


protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = "Grid Refreshed at: " + DateTime.Now.ToLongTimeString();
}



Here is HTML desing code:

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="30000">
</asp:Timer>
</div>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Grid not refreshed yet."></asp:Label><br />
<asp:Label ID="Label4" runat="server" Text="(Grid Will Referesh after Every 30 Sec)" Font-Bold="true"></asp:Label> 
<br /><br />
<asp:DataGrid ID=GridData runat="server" Width="100%" GridLines="Both" HeaderStyle-BackColor="#999999" AutoGenerateColumns="false">
<Columns>
<asp:BoundColumn DataField="EmployeeID" HeaderText="Employee ID"></asp:BoundColumn>
<asp:BoundColumn DataField="FirstName" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="City" HeaderText="City"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</ContentTemplate>
</asp:UpdatePanel>
</form>


I hope you liked this article..if yes please drop some comments

kick it on DotNetKicks.com

Wednesday, April 2, 2008

Sending Emails With MSMQ

Microsoft Message Queuing

I was assigned with a website which needs to be scalable and optimized.We were facing a lot of unexpected things in the development of the scalable website. In the mid of this project i was asked to develop a module for mass emailing .The traditional email sending method using SMTP for website for large amount of user will not solve the bulk email sending and it will become a bottleneck in the scalability of website. For this i was in thought process of developing an email module which can cater mass emails and while surfing INTERNET found MSMQ got into depth of MSMQ and found the solution to send email via MSMQ. MSMQ as the name suggest is related to Microsoft Message queuing service. Before going into details i would like to tell you the advantages of sending emails via MSMQ
1.

Wednesday, March 19, 2008

Visual CSharp Debugger

Introduction

During the last several months, I have dealt with many users from both inside and outside of Microsoft who have debugging issues. I noticed that there are many common mistakes and problems that can be solved, if users are provided with proper diagnosis. Hence, I’ve written this document to provide you with this information which will help you if you run into any issues while using the debugger.

This document contains:
Error message dialog or description of error situation
The causes for error
How to fix the problem.
And I especially thanks to VCS debugger team and other people who helped me to complete this document with various feed back.

Debugging issues
ASP.NET Debugging
*If you can’t find the error message that you’re looking for in this section, please check the section which deals with general debugging issues or remote debugging issues.



Message: Unable to start debugging on the web server


Case 1: Your IIS application of IIS is not configured to use “integrated Windows authentication”. Please make sure that the “integrated windows authentication” checkbox on the “authentication method” dialog box is checked.



Case 2: Please check whether “Enable HTTP Keep Alives” option of IIS is checked or not. If it is turned off, you may need to turn it on and try your debugging again.

Message: You do not have permission to debug the server



Cause 1: Make sure that “Integrated Windows Authentication” is enabled. Probably, you enabled only “Basic authentication” for Directory security of IIS.
Cause 2: If you are using “Integrated Windows authentication”, you need to make sure that your user account has full control on the directory of the IIS.
Cause 3: If you created the web project with a full machine name (like “machinename.domainname.something”), the web site is recognized as “Internet” site. So the default setting of IE will impact on the behavior of log on. In this case, you need to enable logging on with your current user account in “Internet” area with IE setting. But it is not the default setting of IE, so you’d be better off if you create project with only the machine name.




Message: Server side-error occurred on sending debug HTTP request.




Cause 1: Your web application doesn’t have an Application name. Please check the properties of the web project using the IIS MMC to ensure that your web project has an application name




You need to create an application name for debugging.

Cause 2: If you are using the NTFS file format, please make sure that “aspnet” has proper privilege on “wwwroot” or your folder for virtual directory to access and write on the folders.
Message: The project is not configured to be debugged.



You need to make sure that your web is configured for debugging. To do this, you need set “debug = true” in the “web.config” file. You may find this file in your web project folder.
Can start debugging without error message, but breakpoints are not hit.

You started debugging with “F5” and it looks like debugging is started properly, and IE is launched properly. But you can’t hit a breakpoint on my code behind code.

Cause 1: Please make sure that “asp.net debugging” is enabled in the properties of project.




In the case of VB project, the UI is different. But you can recognize the equivalent one easily.

Cause 2: Please make sure that the expected DLL is loaded with matched debug symbol file. You can check it with “Modules” window.
Message: The debugger is not properly installed.





If you see this problem, please check debugging with console application project. And if the console application project shows the error message like






It means that your .Net framework is not installed properly. So you need to register “mscordbi.dll” manually by executing “regsvr32 mscordbi.dll”.
Message : The server does not support debugging of ASP.NET or ATL server applications.






If you have an XP Pro or W2K Pro machine, you may need to think about the order of installation between VS7 and IIS. If you install IIS after VS7, you will get this error. In this case, please register “aspnet_isapi.dll” with “aspnet_regiis.exe –i”.
Message: Access is denied. Verify that you are an administrator or a member of …



You may not be the member of “Debugger users” group on the machine. Please add your user account into “Debugger users” group on the machine.

To add your user account into “Debugger users” group, you need to do the following:

1. Log in as “Administrator”
2. Run “Computer management” in “Administrator tools”
3. Choose “Local users and groups\groups” node
4. Double-click “Debugger users” group on right pane.
5. Click “Add” button on “Debugger users properties” dialog box.
6. Type your user account and click “Ok” button.
Message: Could not start ASP.NET or ATL server debugging.



Case 1: You may have installed “IIS Lockdown” tool. If so, Please find “urlscan.ini” file, and add “DEBUG”(case sensitive) into “[allowverbs]” section in “urlscan.ini” file.

Case 2: if you are using Domain controller as server, and your project is created with machine name than full domain name, you may need to change the URL of project to use full domain name.

Case3: if your IIS is set to use dedicated IP as “Web site identification”(you can find this option in IIS setting with IIS MMC), you may see this error message. In this case, you need to change your project name to use the IP address directly. For existing project, you need to change project to use IP address than just machine name by editing “.sln” file and “.webinfo” file.

Case4: if you do change the value “” in “web.config”, please make sure that the value is not too big. The default unit is “Kbyte”, not “byte” so if you put too big number, it causes problem with debugging.
Message: Access is denied.



You may be the member of “Debugger users” group, but you don’t have the right to debug the aspnet worker process, because you are not the “aspnet” user account or the member of “Administrators” group. Please add your user account to the “Administrators” group on the machine.
Can’t debug with an included File
Inside of ASPX, you can't debug with an included file. It may easily happen, when you convert old ASP project to ASPX.

If you include file with "", you may not be able to debug the include file properly. In this case, you need to use "".
After changing your password, you need to log off/log in for ASP.NET debugging.
After you change your password, you need to log off and log in to do ASP.NET debugging properly.

After installing Windows2000 SP4, ASP.NET debugging doesn’t work and it says “Access denied”.
After Windows 2000 SP4, if you ASP.NET debugging doesn’t work by pressing “F5” and it says “Access denied”, please re-register “aspnet_isap.dll” with “regsvr32 –i aspnet_isap.dll”. it will fix the problem.

Can hit breakpoint only when the page is loaded first time.
There may be several different cases of this problem. but one of well known cases is that you may turn on page cache option in “web.config” file.
If you see something like “” in “web.config”, you need to set the value as “False” to turn off web page cache. It will let you hit breakpoint when you refresh the page.

Need to share web server for debugging but I don’t want to let other users to be admin on my machine.
In VS.Net, we have two things to decide whether user can start debugging. One is “Debugger users” group and the other is user privilege like administrator or power user or SEDebug.
Debugger users group decide whether the user can access VS debug component (mainly MDM-Machine Debug Manager- which is part of VS). So being the member of debugger users group means that you are guaranteed for accessing MDM. So at this point, you can debug your open process and see the list of process on your machine.
But after this, whether you can debug other user’s process is decided by your privilege. For example, if you want to debug other people’s native process, you should have SEDebug privilege. For the other users’ Managed process, you should be administrator on the machine.
Because of this restriction, in your scenario, the student should be granted as admin. If not ASP.Net work process can’t be debugged by default.

We have a sort of work-around. Cassini is stand-alone small ASP.NET server. So for students, they can use Cassini for developing things, and later they just need to deploy thing over to the actual server for submit the result. The Cassini is available on http://www.asp.net/Projects/Cassini/Download/.

General Debugging
These cases are based on “Console application” project type.

Message: Unable to start debugging. Unable to start program …



You can’t start debugging because “mscordbi.dll” is not registered properly. Please register it manually.
Message: Unable to start debugging. Access is denied



Please make sure that “Machine Debugger Manager” service is started properly.
Please check that you are the member of “Debugger users” group or “administrators” group.
Can start Managed debugging, but PDB is not loaded. So, can’t hit any Breakpoints at all.

If you can start debugging and debuggee is launched properly, but you couldn’t hit any BP, you may need to check the installation of “diasymreader.dll”.
The file may not be registered. So you need to register it manually.
To register it, you need to do
find out “diasymreader.dll”
regsvr32 diasymreader.dll
Managed debugging is not working

You attach to native process in CLR mode before the process creates the CLR object. Managed debugging is not working.

Solution 1: Attach to the process after CLR code is used in the process.

Solution 2: Attach to the process in InterOp mode. In this case, you don’t have to attach to the process after CLR code is invoked.
Managed debugger doesn’t respond

When you start debugging with managed code, the debugger doesn’t respond at all.

Please make sure that the “.Net framework support” service is stopped and disabled forever. (just stopping the service is not enough.)

If you don’t have “.Net framework support” service, Please disable “IIS admin” service. It may help you.
Stepping with C# code is not correct…

Consider the following code
string someStr; someStr = "SomeValue"; if(someStr == null) Console.WriteLine("what's up?");
try { } catch(Exception e) { } If you step through this code, you will see that when you step into the "if" statment, the instruction pointer is moved to the body("Console.WriteLine("what's up?");") of the "if" statement. This is not debugger bug, it is known issue with try catch block debug information. See the followingdisasembled code
if(someStr == null) 0000002a cmp dword ptr [ebp-18h],0 0000002e jne 0000003C
Console.WriteLine("what's up?"); 00000030 mov ecx,dword ptr ds:[01C50070h] 00000036 call dword ptr ds:[02F0257Ch] 0000003c jmp 00000048
catch(Exception e) 0000003e mov dword ptr [ebp-1Ch],eax 00000041 call 762C0846 00000046 jmp 00000048
} 00000048 nop
When the value is not matched, the instruction pointer is moved to "3c" line, but the line is mistakenly matched with the body of "if" statement. While the code functions correctly, the appearance is incorrect.
Causality debugging: Stepping between web service client and web service.
Can’t set from web service client into web service
With the default settings, you can’t step from web service client into a web service. It works like step-over.

The ASPNET worker process (aspnet_wp.exe or w3wp.exe) is running under the “aspnet” or “network service” user accounts, and these accounts don’t have privilege to access MDM via DCOM. So you need to add these accounts into the “Debugger users” group.

After enabling impersonation of web service, can’t do causality stepping.

When impersonation is enabled for the web service with “web.config”, stepping into from web service client code to web service code is not working. So it works like step over.

You need to do these things for correct stepping between client and service. - turn off "Anonymous access" in IIS. - change your clinet code to set credential to webservice like Service1 obj = new Service1(); obj.Credentials = System.Net.CredentialCache.DefaultCredentials;
After this, you will be able to step into the web service from client.
These are needed, because when you step into web service, some framework components need to use the system level debugger component (MDM) to cocreate it. If you don't give your proper credentials, it just fails to do the "cocreation". Without these the proper credentials, "step into" works like "step over"

Debugger hangs
If your web service client code is running in STA(Single thread Apartment) model, and it is waiting for an async call completion like:

Service1 obj = new Service1();
System.IAsyncResult ar = obj.BeginHelloWorld(new System.AsyncCallback(Class1.Handle),obj); while(ar.IsCompleted != true) { System.Threading.Thread.Sleep(1000); }

The debugger will hang. This hang occurs because one debugger component is locked by your code inside of debugger

Solution 1:
Change your code to use thread sync with event or mutext.

Solution 2:

Unregister “csm.dll”. In this solution, it will disable causality stepping (stepping from web service client code to web service method). You may need to attach to “aspnet_wp.exe” manually for debugging web service.

Remote debugging
Can’t see any processes on a remote machine

Can’t see any processes on a remote machine.

Please make sure that you installed “Remote full debug” setup on the remote machine, and that you are a member of “debugger users” group.

Can’t connect to a remote machine because of RPC issue
* this information is from one of KB articles. Thanks for “Mike Clay” who wrote this KB.
If you see the below error messages while you are connecting to remote machine with “Processes” dialog.

Error while trying to run project: Unable to start debugging on the web
server. Not enough storage is available to complete this operation.

Or, you see the below, during ASP.NET debugging.
Error while trying to run project: Unable to start debugging on the web
server. Unable to map the debug start page URL to a machine name.


Please make sure that RPC is working properly between your machine and the remote machine. the reason of RPC issue can be from
1. Debugging through a firewall. Microsoft does not recommend or support remote
ASP.Net debugging through a firewall. The best way to do overcome this is use
Terminal Services to log into the remote server and debug locally.

2. One common failure for RPC is the inability to resolve the remote machine
name. RPC relies on name resolution for communication between machines. If
you are unable to resolve the remote servers machine name to the correct IP
address errors may occur.

3. RPC Traffic can flow in one direction but not the other. RPC traffic must be
able to go from the machine used to do the debugging to the remote server and
from the remote server back to the machine used to do the debugging in order
to successfully debug remotely. Make sure that RPC communication is enabled
in both directions.

To analyze your RPC, you can use “RPCPing” tool.

Remote debugging fails with machines on a work group
You have two XP Pro machines that are not on a domain, but on a work group. When you do remote debugging between them, you can’t access remote machine at all. What’s wrong with it?

In the work group environment, you need to make sure that you have the samenamed user account on both machines with the same password. If not, DCOM will fail to authenticate you.
There is one more consideration:
On XP Pro, because of the default security setting for "sharing and security model for local accounts", this remote debugging is not allowed by default. Below are the steps to change this setting:
1. Run "Local Security Settings" in Administrator tools.
2. Select "Security settings\Local policies\Security options.
3. Change "Network access : Sharing and Security model for localaccounts" from "Guest only - local users authenticate as Guest" to"Classic - local users authenticate as themselves".
4. After this, you need to reboot the machine.
This change should be applied onto both machines for remote debugging.
After you make the setting change, you will be able to do remote debugging with the same name user account on both machines.
Please make sure that your user accounts on each machine has password. In some cases, without actual password it doesn’t work.
However, ***there is a concern with security with this change***. Because you changed default settings of the security model, it can expose:

Unexpected file sharing
Unexpected DCOM components sharing.
Before you make this change, any kind of connection from remote machine to your machine was guaranteed as "Guest", but after this change, he/she could be authenticated with your local user account. So, like the case of debugging, if you are sharing out a folder or DCOM object, there is a possibility that any matched user (same user name and same password) on other machine could access your shared objects.
I strongly recommend that, if you want to use this work-around, you make sure that all user accounts have strong passwords, or should setup network-Island for the debugging machines to prevent any malicious attack.



kick it on DotNetKicks.com

job search