I'm assuming that you are using a soundcard with midi in/out and not an usb or external midi device.
Always start with the basics. Start with the MIDI cables. Try different cables. Second, get the latest drivers and check if your soundcard is sharing it's IRQ with other hardware. This is probably the main cause for the souncard to act up, even when it shows that everything is ok. Reinstall the drivers or move the soundcard to another empty slot in your computer. You can also try to connect another MIDI sending device to the MIDI port to check if it is receiving. Last, but not least, some keyboards do not send MIDI by default. Some have an internal "send midi out" switch that has to be enabled. Check that it send in the correct chanel and that it matches the recording midi chanel.
But, I would bet that your problem will be solved by removing the soundcard and drivers and installing again. I have done this so many times over the years that it's not funny anymore!
These suggestions are based on the minimal info given in your post and my own experience.
If the soundcard is built in your motherboard, is it enabled? Is your software configured to receive from your soundcard's midi out?
Health & Joy