“Error: Server sent unexpected return value (405 Method Not Allowed)”

I ran into a funky issue with the interaction between SVN, Visual Studio and my brain recently. I was trying to commit some changes I made to a project and during the commit got slapped with something like this:

“Error: Server sent unexpected return value (405 Method Not Allowed) in response to Error: MKCOL request for …

I did some Googling, tried some creative suggestions here, all somewhat unsuccessful.

Eventually, I started looking at the nature of the change that I made, which among other things included addition of a service reference to a project. However, I realized that it’s not exactly what happened. I didn’t add a service reference, but instead I deleted a service reference and then added it back..

The difference is that when you delete a service reference from the project, Visual Studio deletes the entire directory for that service reference, including associated hidden svn files. What I am guessing happens as a result is that Subversion sees the directory as a new directory instead of realizing that it existed before and hence tries to create it on the server, which fails since it already exists.

WTF indeed.. I worked around it by temporarily renaming the “new” service reference directory, getting the old one via SVN update, and then just replacing the service reference files and keeping hidden ‘.svn’ items in tact. Now SVN saw my changes as modifications to an existing directory as opposed to an Add.

Hope this helps,