Solving random 404 errors while editing release definition environments on TFS 2015


Dealing with too many environments


Getting straight to the point, remote chances are that you may be using way too much environments on a single release. Normally, this would never happen, as the usual route is to have dev, qa, staging, and production environments at most. And because of that, they never thought this could possibly become an issue.

When you edit a release, a web api call is made to check the current user’s permission to access each one of them. If this method happens to fail, you won’t be able to access the context menu options for each environment (such as variables or deployment conditions).


A token for me, a token for you, a token for everyone


This specific api call carries a query string property “tokens” that concatenates a token (which, I’m assuming, refers to the user) and the specified environment id for each environment present on the release definition. If this query string (or the whole url, for that matter) becomes too huge, you may get a 404 error instead of the expected result.

To fix that, you need access to the server where TFS is located, because a change in the tfs app web.config is required. The values that need fixing are the following: “maxUrlLength” and “maxQueryStringLength”, located at httpRuntime; “maxUrl” and “maxQueryString”, located at requestLimits.

<httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" ... />
<requestLimits maxUrl="10999" maxQueryString="2097151" ... />

Setting a higher value for them should fix the issue.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s