As with many things in medicine, it depends on specifics and context. With some viruses, this might work, and with others it could kill you. Vaccination itself is tricky partly for this very reason as far as I know (not a doctor or epidemiologist).
Variolation for example, the predecessor to the world's first practice of vaccination (against smallpox) involved taking tiny amounts of live smallpox from scabs or pustules and giving them to people intentionally for a much lighter infection course that made them immune without the usually killing or horrifically disfiguring blow of a full smallpox infection. (look up photos of smallpox scars in survivors, warning, it gets graphic. Even many famous figures like Stalin were completely pockmarked by the scars of the virus for the rest of their lives, as you can see in unedited photos of the dictator)
It usually worked, but sometimes the patients got really sick anyhow and died. By the standards of the time, when fully a third of the population could expect to die from some epidemic disease or another, this was considered wonderful. Today it wouldn't be and thus the complexities of carefully calibrating vaccines.