404 Errors In Log Files

Nov 14, 2012 at 8:27 PM

After setting up TFS 2012 from a TFS 2010 upgrade and moving over SvnBridge from the old TFS 2010 server everything seemed to be working fine from within TortoiseSVN except when I would get about three levels deep in the folder structure I started getting 404 errors in the SvnBridge logs.

Exception:
   System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at CodePlex.TfsLibrary.ObjectModel.WebTransferService.DownloadBytes(String url, ICredentials credentials)
   at SvnBridge.Infrastructure.FileRepository.GetFile(ItemMetaData item, Guid repositoryUuid) in C:\Projects\SvnBridge\SvnBridgeLibrary\Infrastructure\FileRepository.cs:line 29
   at SvnBridge.SourceControl.TFSSourceControlProvider.ReadFile(ItemMetaData item) in C:\Projects\SvnBridge\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 650
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetItems(Int32 version, String path, Recursion recursion, Boolean returnPropertyFiles) in C:\Projects\SvnBridge\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 809
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetItemsWithoutProperties(Int32 version, String path, Recursion recursion) in C:\Projects\SvnBridge\SvnBridgeLibrary\SourceControl\TFSSourceControlProvider.cs:line 204
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 75
   at SvnBridge.Proxies.RetryOnExceptionsInterceptor`1.Invoke(IInvocation invocation) in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\RetryOnExceptionsInterceptor.cs:line 27
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.TracingInterceptor.Invoke(IInvocation invocation) in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\TracingInterceptor.cs:line 28
   at SvnBridge.Proxies.RemotingInvocation.Proceed() in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\RemotingInvocation.cs:line 59
   at SvnBridge.Proxies.ProxyFactory.RemotingProxy.Invoke(IMessage msg) in C:\Projects\SvnBridge\SvnBridgeLibrary\Proxies\ProxyFactory.cs:line 46
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at SvnBridge.SourceControl.TFSSourceControlProvider.GetItemsWithoutProperties(Int32 version, String path, Recursion recursion)
   at SvnBridge.Handlers.GetHandler.Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) in C:\Projects\SvnBridge\SvnBridgeLibrary\RequestHandlers\GetHandler.cs:line 58
   at SvnBridge.Handlers.RequestHandlerBase.Handle(IHttpContext context, IPathParser pathParser, NetworkCredential credentials) in C:\Projects\SvnBridge\SvnBridgeLibrary\RequestHandlers\RequestHandlerBase.cs:line 46
   at SvnBridge.Net.HttpContextDispatcher.Dispatch(IHttpContext connection) in C:\Projects\SvnBridge\SvnBridgeLibrary\Net\HttpContextDispatcher.cs:line 132
   at SvnBridgeServer.SvnBridgeHttpHandler.ProcessRequest(HttpContext context) in C:\Projects\SvnBridge\SvnBridgeServer\SvnBridgeHttpHandler.cs:line 59

I was able to setup remote debugging to the server and realized that in the Web.config file I did not have a trailing / at the end of my TfsUrl.

Incorrect:

<add key="TfsUrl" value="http://tfs12:8080/tfs"/>

Correct:

<add key="TfsUrl" value="http://tfs12:8080/tfs/"/>

What I found out was in SvnBridge\SvnBridgeLibrary\Infrastructure\MetaDataRepositoryNoCache.cs line 73 the code is doing a contains on the path "/tfs/" and since my url was only "/tfs" it was not matching and was thus calling the asmx service and not the ashx handler which TFS 2010 and TFS 2012 is expected.

var downloadUrlExtension = serverUrl.Contains("/tfs/") ? "ashx" : "asmx"; 
Hope this helps someone else in the future.

Nov 15, 2012 at 6:11 AM
rmeans wrote:

I was able to setup remote debugging to the server and realized that in the Web.config file I did not have a trailing / at the end of my TfsUrl.

Incorrect:

 

<add key="TfsUrl" value="http://tfs12:8080/tfs"/>

 

Correct:

 

<add key="TfsUrl" value="http://tfs12:8080/tfs/"/>

 

What I found out was in SvnBridge\SvnBridgeLibrary\Infrastructure\MetaDataRepositoryNoCache.cs line 73 the code is doing a contains on the path "/tfs/" and since my url was only "/tfs" it was not matching and was thus calling the asmx service and not the ashx handler which TFS 2010 and TFS 2012 is expected.

 

var downloadUrlExtension = serverUrl.Contains("/tfs/") ? "ashx" : "asmx"; 
Hope this helps someone else in the future.

 

 

Thanks for the perfectly detailed report!

I'll be fixing this as well in my (currently local) current patchset (detect TFS URL type by accepting both contains "/tfs/" or ends with "/tfs" - internet search for "TfsUrl http" actually has many hits for the latter style, thus it's a rather gross bug!).

I'll check whether some possible code duplication does incorrect checks, too.