Your explanations and screenshot sound as if the mesh is oriented in the wrong direction. To have a mesh being deformed along the curve, it has to be oriented in the curve's local +X direction.
It does not matter if the mesh object is rotated in a different direction than the curve, as long as the mesh which you want to be deformed by the curve extends in the same direction as the curve's local coordinates are oriented.
An example: in the following image there is a curve without any transformations, everything oriented along with the global coordinates. The same goes for the mesh object. All transforms are applied and the mesh extends in +X direction.

Now what appears to be your problem is the following: your mesh and your curve are oriented in the opposite direction. As you can see in the example below, although the curve object and the mesh object are oriented in the same direction, the mesh extends into the opposite direction. Therefore it is not deformed along the curve, but pointing away from it. Actually it is not really pointing away, it is just that the mesh is placed "before" the curve, and since there is no more curve to be deformed with, it is just straight along the tangent of the curve's starting point. Same happens with meshes that are too long for a curve. Everything after the curve is just pointing straight into the end point's tangent direction.

The thing is, as long as your mesh is extended in the same direction as the local +X or "forward" direction of curve, it will be deforemd along the curve, no matter which orientation the object containing the mesh has.

The only other important thing is, to not have a strange offset: the part of the mesh, which you want to be at the starting point of the curve, has to be at the origin of the curve. It is not even necessary for the mesh object to have the same origin as the curve, as long as the mesh is there it will always begin deforming at the curve's starting point.
