A road has been blocked and trains cancelled because of a level crossing failure.