When traveling to multiple Schengen countries, which consulate is the visa applied through?

If you're traveling to multiple Schengen countries you should apply for a visa for the country in which you will stay the longest. If you do not have a main destination, you should apply for a visa for the country that will be your first point of entry.