If you are recorded in the National Registry as resident in a Norwegian municipality, you are entitled to have a regular doctor, your GP. If you do not yet have a GP, you can find a list of them here at helsenorge.no. If you have a D number, you will generally not have a right to a GP. Find out more about the GP scheme here.
If you do not have a right to a GP, you are, however, entitled to be covered for expenses for necessary healthcare, but you yourself have to find a public surgery with spare capacity. The municipalities are responsible for ensuring that you receive the healthcare you need. Some municipalities have a list of doctors who accept patients who are not entitled to a regular GP. Check your municipality's website.
Contact the out-of-hours primary care service for urgent help in the evening or at weekends.
You will have to pay a user fee for treatment. The amount of the user fee will depend on which healthcare services you need. You pay user fees up to a certain amount over the year, after which you are entitled to an exemption card.
Example
Lech needs to visit a doctor. Since he is not registered in Norway's National Registry, he is not entitled to a regular GP. Lech therefore has to find a doctor who has spare capacity. He checks the municipality's website and finds a list of doctors who accept patients who are not entitled to have a GP. After calling a couple of them, he finds a doctor who can see him. He pays this doctor a user fee, just as Norwegian citizens do. He is careful to keep the itemised receipt, so he can apply for an exemption card if he reaches the user fee threshold during the course of the year.