Tournaments are frequently adopted to procure goods and services for which spot markets do not exist, contracts are incomplete and outcomes cannot be verified in a court. Examples of such procurement contests include R&D tournaments held by the government agencies and large corporations. It is widely acknowledged that open participation is undesirable in such contests and tools such as entry fees and contestant selection auctions are suggested to restrict participation. With rapid evolution of the Internet and the Web, a new generation of procurement tournaments has emerged. The Web now allows almost any firm or individual to organize its own minor tournament, sometimes with just a few mouse clicks. A number of companies use this opportunity to run contests in which contestants develop and submit ideas or products, and prizes are awarded to one or more winners chosen by the company conducting the contest. All of these tournaments are characterized by the absence of entry fees, open participation, sunk efforts and a significant number of contestants. This paper presents an economic model of an all-pay contest with heterogeneous contestants. There is a contest sponsor that values K contest submissions. The contest offers L prizes and there are N risk-averse, wealth-constrained contestants who differ in their skills (their ability to produce quality solutions), and who turn in their submissions simultaneously. Our first result shows that every such game of incomplete information satisfying the Single Crossing Condition has a unique symmetric Bayes-Nash equilibrium in pure strategies, and that equilibrium effort levels are monotonic in ability. Thus, the equilibrium of the contest is efficiently ranking in that it ranks the winners in the decreasing order of their abilities. Next, we derive the asymptotic behavior of the bid function and the submission qualities. We show that, asymptotically, only the support of the type distribution and the cost function at the support determine the contest outcome, therefore, in the limit, the game has a particularly simple structure. Next, we show how that the speed of convergence to the asymptotics is of order 1/N and the asymptotic outcome can be used to construct an upper bound on the outcome in any finite sample game. Finally, we show how our result can be applied to derive the asymptotically optimal allocation of prizes for the profit-maximizing tournament sponsor and show that the optimal solution of the finite-sample allocation problem converges to the asymptotic one as the number of participants grows. In particular, it is shown that when the contestants are risk-neutral, the sponsor's optimal contest design places most of the budget on the top prize and sets the remaining prizes at their lowest possible levels (the minimum necessary to facilitate the transfer of the intellectual property). When the contestants are sufficiently risk-averse, the firm may optimally offer more prizes than there are the desired submissions, thus awarding prizes even to submissions it does not eventually want. As the aggregate surplus of contestants converges to zero when the number of participants grows, the profit maximizing prize structure is asymptotically socially optimal.