Recently came across some issues while upgrading from Visual Source Safe (VSS) 2005 to Visual Studio Team Foundation Server (VSTFS) 2010. Found some workarounds and limitations. I am assuming you are using Visual Studio 2010

On TFS Server Machine

1. If your projects are using .NET framework 3.5 or higher, make sure the respective .NET Framework is installed on the Server

2. Make sure that output folder where TFS will build the projects have write permission

3. If you are using Enterprise Library or any third party tool, they are also installed on the Server.

4.  You may get an error during Build of the project about “Microsoft.WebApplication.targets“, to resolve this issue C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets from local (development) machine which had VS 2010 already installed.

5. If you have some components or dlls for which you do not any installer or they can not be installed in GAC but they are referred in your projects, One way to fix this issue is to copy that dll in to into C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0

Some informative links

http://msdn.microsoft.com/en-us/library/bb668981.aspx

http://www.attrice.info/cm/tfs/

http://blogs.microsoft.co.il/blogs/eranruso/archive/2010/01/25/how-to-configure-build-services-to-a-specific-tfs-2010-collection.aspx

 

On Development Machine

How to Find your workspaces?

Go to Visual Studio Command Prompt, and use one of the following commands

C:\tf works

In order to delete any of the workspace, you can use following command

C:\>tf workspace /delete /server:BUILDSERVER WORKSPACENAME;OWNERNAMEpaces /owner:*

Important: Make sure that the TFS still has the same collectionname and path. If you or administrator deleted a collection directly from TFS you will not be able to delete or clear your old workspace. Microsoft should have provided a way to address this problem.

How to Delete a Collection?

1. Go to Command Prompt

2. Go to C:\Program Files\Microsoft Team Foundation Server 2010\Tools

3. Type C:\TFSConfig Collection /delete /collectionName:[COLLECTION NAME]"

Note: Delete does not delete from TFS, but just marks the item as deleted, in order to fully delete it, you will have to destroy it

How to Destroy?

1. Go to Command Prompt the

2. Go to C:\Program Files\Microsoft Team Foundation Server 2010\Tools

3. tf destroy $/<PATH_OF_THE_FOLDER_OR_OBJECT> /collection:[COLLECTION_NAME_WITH_HTTP_ADDRESS]

For more info visit following link

http://msdn.microsoft.com/en-us/library/bb386005.aspx

 

Signature

Just came across this error when I upgraded my Blog from .NET 3.5 to .NET 4.0  - A potentially dangerous Request.Form value was detected from the client .....

Ok, so first I thought may be I missed the Page directives. Checked that and it was there, played around with different settings and configurations, but nothing helped.

But finally the solution was revealed:) and it was very simple as you can see below. In .NET 4.0, Microsoft added another parameter “requestValidationMode” in httpruntime which will stop this error. So open your web.config and add following.

 

Code Snippet
  1. <system.web>
  2.  
  3.      <httpRuntimerequestValidationMode="2.0"/>
  4.  
  5. </system.web>

 

 

Remember if your website is still using .NET 2.0 and getting the same error, make sure that the page directive “ValidateRequest” is set to false.

Code Snippet
  1. <%@ Page Language="C#" MasterPageFile="masterPage.master" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" ValidateRequest="False" %>

Signature

If you are using a WCF (Web) Service in client application and dealing with large data, at some point you may come across an error message:

{"The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."}

 

Solutions:

Open your web.config or App.Config file at client and change the values in your bindings. Change the value of following configurations from 65536 (default) to 2147483647. That means it will allow up to 2GB.

<wsHttpBinding>
    <binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
     bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text"
     textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
     <reliableSession ordered="true" inactivityTimeout="00:10:00"
      enabled="false" />
     <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="Windows" negotiateServiceCredential="true"
       algorithmSuite="Default" establishSecurityContext="true" />
     </security>
    </binding>
   </wsHttpBinding>
Signature

If you are using .NET 2.0 or higher Framework and System.Transactions Namespace to handle your transactions, chances are you may come across this error. In my application, I was using ADO.NET transaction, in stored procedure SQL Server transaction and now we decided to use a powerful transaction handler using .NET framework. If you are writing everything fresh, most likely you won’t like to mix different type of transaction handling mechanism. But what if you already have existing code and do not want to change, what to do. I tried to mix all the three kind of transactions, but it resulted in errors. Sometime, they timeout, sometime it just hanged and sometime it produced Microsoft Transaction Coordinator (MSDTC) error. So, how to resolve this problem? After spending several hours I found that one must follow following basic steps.


 

1. Import System.Transactions namespace in the class where you want to use distributed transaction

2. Make sure that this transaction mode is the root or mothers for all other type of transactions

3. Now you can add different type of transactions, it can be ADO.Net transaction, SQL Transaction or another child transaction using System.Transaction Namespace

4. After doing the first 3 steps, make sure you configure your machines with following options, otherwise you will come across the above error.

To fully enable MS DTC:

1. In Control Panel, open Administrative Tools, and then double-click Component Services.

2. In the left pane of Console Root, click Component Services, and then expand Computers.

3. Right-click My Computer, and then click Properties.

4. On the MSDTC tab, click Security Configuration.

5. Under Security Settings, select all of the check boxes.

6. Verify that the DTC Logon Account name is set to NT AUTHORITY\NetworkService.

 

 

 

If MSDTC still does not work then

1. Install MSDTC by going on command prompt and run following command: msdtc –install

2. After that you'll need to actually start the service

3. Make sure to go back in component services and follow the above step to enable MS DTC.

4. Windows Firewall –Make sure C:\Windows\System32\MSDTC.exe is added in Exceptions list of Windows Firewall

 

 

 

       If MSDTC still does not work, reboot the machine.

If you MSDTC still does not work, download the following tool and you can see where it is failing

                  http://www.microsoft.com/downloads/details.aspx?familyid=5E325025-4DCD-4658-A549-1D549AC17644&displaylang=en 

                  You need to make sure that these options are enabled on all participating machines (Web Server, App Server, SQL Server etc)


Example:
 
                 Public Sub MainMethod()
                       Dim tranOptions As New TransactionOptions()
                       tranOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
                       tranOptions.Timeout = New TimeSpan(0, 2, 0)
                       Using topMostScope As New TransactionScope(TransactionScopeOption.Required, tranOptions)
 
                            Call Method1UsingAdo_Net_Transaction()
                            Call Method2UsingSql_Server_Transaction()
                            Call Method3UsingChildTranScope()
 
                            topMostScope.Complete()
                       End Using
                End Sub
 
 

 

 

Signature

Recently I came across interesting error messages while calling a WCF Service Hosted in IIS 6.0 on Windows 2003 Server. From the error message, I could not figure out the real cause. But after doing some research and changing few configuration information and changing the code, it appears that these solutions fixed these errors.

 Errors

System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway,  ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)  at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService( IMethodCallMessage methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage message)    Exception rethrown at [0]:   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage( IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
 Or
System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)      at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
Solutions
1.       Increase the default value of maxConcurrentCalls from 16 to 50 and maxConcurrentSessions from 10 to 50. You can increase even higher based on your need.
<serviceBehaviors>
    <behavior name=" ServiceBehavior1">
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceThrottling maxConcurrentCalls="50" maxConcurrentSessions="50"/>     
     <serviceTimeouts />
    </behavior>  
   </serviceBehaviors>
 
2.       Use “Using Block” in Service Client to gracefully dispose the object. Also, explicitly close ChannelFactory and Client.
          Using svcClient As ServiceReference1.Service1Client = New ServiceReference1.Service1Client()
           ' Or  Using svcClient As ServiceReference1.Service1Client = New ServiceReference1.Service1Client("EndPointConfigName", "ServiceRemoteAddress")
            'Do the Service related stuff here
            'Before you end the process explicitly Close Client's ChannelFactory and Client
            'Note: Closing the ChannelFactory Closes Client as well but Closing Client does not close the ChannelFactory
            svcClient.ChannelFactory.Close()
            svcClient.Close()
        End Using
Signature

I got this error when calling a WCF Service over HTTPS. A Similar error can also occurs when you try calling a web service programmatically over SSL (HTTPS) and certificate is either not valid or Certificate is attached to a domain and you are not using the domain name but the machine name or IP address. So, what to do in that case if you don’t care about certificate and would like to accept all certificates. I found that it can be done using one of two ways. 

Main Class – Where you are calling the Web Service, add following Import Statements
Imports System.Security.Cryptography.X509Certificates
Imports System.Net.Security
Imports System.Net
 
Public Class MyWebServiceCall
 
    Public Sub CallServiceUsingFunction()
        'Instanciate the Service here
        'Set all paramaters which you need to pass
        'Before You call the Service
        ServicePointManager.ServerCertificateValidationCallback = AddressOf TrustAllCertificatesCallback
        'Call your service Now.......
    End Sub
 
 
    Public Shared Function TrustAllCertificatesCallback(ByVal sender As Object, ByVal cert As X509Certificate, _
                                                 ByVal chain As X509Chain, ByVal errors As SslPolicyErrors) As Boolean
        Return True
    End Function
    Public Sub CallServiceUsingClass()
        'Instanciate the Service here
        'Set all paramaters which you need to pass
        'Before You call the Service
        Dim CertOverride As New CertificateOverride
        ServicePointManager.ServerCertificateValidationCallback = AddressOf CertOverride.RemoteCertificateValidationCallback
        'Call your service Now.......
    End Sub
End Class
 CertificateOverride Class - An Alternate Option
Public Class CertificateOverride
    Public Function RemoteCertificateValidationCallback(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, _
            ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
        Return True
    End Function
End Class

 

Signature

You must be thinking that your web site is working great and generating no errors. But have you ever tried catching errors on Application_Error event in Global.asax, it catches all unhandled errors. Try applying the following code, and you will be amazed to see that your site is generating some errors which you were not even aware of. The following method will dump all the erros into a XML file which will be create on monthly basis. Initially I was sending these errors to my email, but it is not easy to analyze all the data at once. XML file can be imported in Excel easily and you can fix the code which is generating more errors.

Drop the following lines of code in your global.asax file - Make sure you choose one format, otherwise you will logging errors twice.

 Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

        Dim exc As Exception = Web.HttpContext.Current.Server.GetLastError()

        If TypeOf exc Is Web.HttpUnhandledException Or exc.InnerException IsNot Nothing Then exc = exc.InnerException

 

        If exc IsNot Nothing Then

            'Attribute Format - Small File Size - less readability

            Call LogErrorAsXMLFileAttribute(exc, Request.ServerVariables("SERVER_NAME"), Request.ServerVariables("REMOTE_ADDR"), Request.ServerVariables("HTTP_REFERER"))

 

            'Element Format  - Large File Size - more readability

            'Call LogErrorAsXMLFileElement(exc, Request.ServerVariables("SERVER_NAME"), Request.ServerVariables("REMOTE_ADDR"), Request.ServerVariables("HTTP_REFERER"))

        End If 

End Sub

 

The Subroutines LogErrorAsXMLFileAttribute and LogErrorAsXMLFileElement are available on my previous post.

Signature

There are some situations especially in development or QA environment when you would to like ignore the SSL certificate. Generally this warning occurs when SSL certificate is either assigned to a different domain name, IP Address or self signed. You will most likely see the one of following error or warning messages when information is posted manually through Internet Explorer or FireFox browser.

1. There is a problem with this website's security certificate.
2. The security certificate presented by this website was not issued by a trusted certificate authority.
3. Website Certified by an Unknown Authority.
4. Unable to verify the identity of release as a trusted site.

If you are trying to post a transaction to such URL programmatically, this warning message will come internally and program will finally throw an exception. 

In order to eliminate this issue, the following settings in Web.config will ignore the certificate.

<system.net>
         <settings>
               <servicePointManager checkCertificateName="false" checkCertificateRevocationList="false"/>
           </settings>
</system.net>

Signature

You might have come across this error while working on a WCF project on Vista, IIS 7.0 with Visual Studio 2005. Actually Microsoft has tightened the security on VISTA and most of the time it is annoying when it asks your permission. Following is the detail error message I received while trying to run a WCF project, however I found a simple solution to fix it.

Server Error

HTTP Error 500.19 - Internal Server Error
Description: The requested page cannot be accessed because the related configuration data for the page is invalid.
Error Code: 0x80070005
Notification: BeginRequest
Module: IIS Web Core
Requested URL: http://localhost:80/ProductsService/ProductsService.svc
Physical Path: C:\Test\ProductsService\ProductsService\ProductsService.svc
Logon User: Not yet determined
Logon Method: Not yet determined
Handler: Not yet determined
Config Error: Cannot read configuration file
Config File: \\?\C:\Test\ProductsService\ProductsService\web.config
Config Source:
   -1:
    0:
More Information...This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

Server Version Information: Internet Information Services 7.0.

Solution: Compile the project and place the deployable files under C:\Inetpub\wwwroot\<projectname>. Make sure that the physical path of the respective Application (e.g. ProductsService in above error case) under IIS now points to new path. 


It looks like that if you run your application under IIS 7 and the physical path of any application is other than wwwroot then it will give the above error message or you provide that folder some special permission so that IIS can access it.

Signature

If you are using AJAX enabled web site or project, you may come across this error message. I got this error message too and spent few hours to fix this problem. I tried finding all possible solutions on Google and finally concluded with following three steps.
 

  •  
    • Web.Config: Make sure your web.config is correctly configured to handle AJAX enabled request. You might have created a project which was not AJAX enabled earlier and now you want to Ajaxfy. The best solution is creating a new project ASP.NET AJAX Enabled Web Site. It will create a Web.config file by default. Compare this Web.config file with your other project’s Web.config file which is casuing the error. Make sure that you are not missing any new section. You can simply copy and paste it at appropriate place. For detail information you can also visit at  http://ajax.asp.net/docs/configuringASPNETAJAX.Aspx
    •  Using Master Page: If your ASP.NET web page is using a Master Page, make sure your Script Manager Control is placed in Master Page only. Content page should not be using Script Manager Control.
    • Regular Web Page: If you are not using a Master Page then each ASP.NET web page must have its own Script Manager Control.
Signature

About Me

Me Hello,my name is Vishwa Mohan Kumar.
I am a Software Architect. This blog is result of my experiments.

Flickr Photos

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent Comments

Comment RSS

Live Traffic Feed