Same problem on my 96 K2500. It was the gas-expansion actuator in the front differential. It had quit working, was drawing too much power, and was blowing the fuse. I replaced it with a Dorman 600-600 (I think that's the model number). The Dorman actuator has an electric motor in it instead of Freon gas. The motor extends the plunger into the differential, locking in the hubs. Since it has a motor, it requires a new wiring harness that has a second hot wire to disengage the plunger, whereas the original disengaged just by cooling off, so it was simply on/off. The new one was on/on/off. The new harness came with a second hot wire that connects into a hot wire near the transfer case. This was the trickiest part because the instructions are far from clear, and the location it says to splice into is impossible for a human to reach. I spliced in farther down the line, and it was good.
When I got it all hooked up, it did not work. The problem was that the connector for the new actuator is different from the connector for the original, so I had to cut off the new one on the new harness and wire in the old one to the new harness. Problem was that the old wires were both the same color, so it was not apparent which was hot and which was ground. I got them backwards. Once I switched them, it worked just fine.
The advantage is that the motorize actuator works instantly and it works in freezing temps. The old gas actuator was crap because in freezing temps it took minutes to heat up and extend the plunger, so you usually did not get 4WD right when you needed it. Also when you shut off the engine, the front axle would disengage, leaving you in 2WD while parked, which can be bad if you were depending on four locked wheels to hold your truck on a slick incline.
There could be other problems besides the actuator preventing your 4WD from working, but this was my problem. I knew it was not the transfer case because when I would hit the 4WD button, the transfer case would make its usual noise, and when I put it in 4 Lo, the rear axle reduced its gear ratio just as it should. But the front hub were not locked in.
My total cost was about $110 on Amazon. Make sure you are getting the correct actuator and harness. Contact Dorman with your VIN and they'll tell you which one to get, if that is in fact what you need to replace.
Hope this helps.