SAP Connector: “ERROR service ‘?’ unknown” (SOLVED)
So you’ve been using the SAP .NET Connector 3.0 for a while and it’s working great to connect your .NET application to SAP when suddenly you start getting this error:
**ERROR service '?' unknown**
You probably have some code like this (or you’re just trying to login or get your app to run):
Server = RfcServerManager.GetServer(serverName, rfcHandlers);
// other init...
Server.Start();
So what happened? I’m guessing you have a new machine or recently removed some SAP-related software. I’m also guessing that if you install the SAP Logon pad, this issue will go away. But you don’t have to go to all that trouble! In my experience, all you need to do is add some configuration to the system services file. Here’s how:
- Open Notepad as an administrator
- Open this file:
%windir%\system32\drivers\etc\services
- Look around for services starting with “sap”
- Assuming you don’t find much, add these lines to the end:
sapdp00 3200/tcp sapdp01 3201/tcp sapdp02 3202/tcp sapdp03 3203/tcp sapdp04 3204/tcp sapdp05 3205/tcp sapdp06 3206/tcp sapdp07 3207/tcp sapdp08 3208/tcp sapdp09 3209/tcp sapdp10 3210/tcp sapdp11 3211/tcp sapdp12 3212/tcp sapdp13 3213/tcp sapdp14 3214/tcp sapdp15 3215/tcp sapdp16 3216/tcp sapdp17 3217/tcp sapdp18 3218/tcp sapdp19 3219/tcp sapdp20 3220/tcp sapdp21 3221/tcp sapdp22 3222/tcp sapdp23 3223/tcp sapdp24 3224/tcp sapdp25 3225/tcp sapdp26 3226/tcp sapdp27 3227/tcp sapdp28 3228/tcp sapdp29 3229/tcp sapdp30 3230/tcp sapdp31 3231/tcp sapdp32 3232/tcp sapdp33 3233/tcp sapdp34 3234/tcp sapdp35 3235/tcp sapdp36 3236/tcp sapdp37 3237/tcp sapdp38 3238/tcp sapdp39 3239/tcp sapdp40 3240/tcp sapdp41 3241/tcp sapdp42 3242/tcp sapdp43 3243/tcp sapdp44 3244/tcp sapdp45 3245/tcp sapdp46 3246/tcp sapdp47 3247/tcp sapdp48 3248/tcp sapdp49 3249/tcp sapdp50 3250/tcp sapdp51 3251/tcp sapdp52 3252/tcp sapdp53 3253/tcp sapdp54 3254/tcp sapdp55 3255/tcp sapdp56 3256/tcp sapdp57 3257/tcp sapdp58 3258/tcp sapdp59 3259/tcp sapdp60 3260/tcp sapdp61 3261/tcp sapdp62 3262/tcp sapdp63 3263/tcp sapdp64 3264/tcp sapdp65 3265/tcp sapdp66 3266/tcp sapdp67 3267/tcp sapdp68 3268/tcp sapdp69 3269/tcp sapdp70 3270/tcp sapdp71 3271/tcp sapdp72 3272/tcp sapdp73 3273/tcp sapdp74 3274/tcp sapdp75 3275/tcp sapdp76 3276/tcp sapdp77 3277/tcp sapdp78 3278/tcp sapdp79 3279/tcp sapdp80 3280/tcp sapdp81 3281/tcp sapdp82 3282/tcp sapdp83 3283/tcp sapdp84 3284/tcp sapdp85 3285/tcp sapdp86 3286/tcp sapdp87 3287/tcp sapdp88 3288/tcp sapdp89 3289/tcp sapdp90 3290/tcp sapdp91 3291/tcp sapdp92 3292/tcp sapdp93 3293/tcp sapdp94 3294/tcp sapdp95 3295/tcp sapdp96 3296/tcp sapdp97 3297/tcp sapdp98 3298/tcp sapdp99 3299/tcp sapgw00 3300/tcp sapgw01 3301/tcp sapgw02 3302/tcp sapgw03 3303/tcp sapgw04 3304/tcp sapgw05 3305/tcp sapgw06 3306/tcp sapgw07 3307/tcp sapgw08 3308/tcp sapgw09 3309/tcp sapgw10 3310/tcp sapgw11 3311/tcp sapgw12 3312/tcp sapgw13 3313/tcp sapgw14 3314/tcp sapgw15 3315/tcp sapgw16 3316/tcp sapgw17 3317/tcp sapgw18 3318/tcp sapgw19 3319/tcp sapgw20 3320/tcp sapgw21 3321/tcp sapgw22 3322/tcp sapgw23 3323/tcp sapgw24 3324/tcp sapgw25 3325/tcp sapgw26 3326/tcp sapgw27 3327/tcp sapgw28 3328/tcp sapgw29 3329/tcp sapgw30 3330/tcp sapgw31 3331/tcp sapgw32 3332/tcp sapgw33 3333/tcp sapgw34 3334/tcp sapgw35 3335/tcp sapgw36 3336/tcp sapgw37 3337/tcp sapgw38 3338/tcp sapgw39 3339/tcp sapgw40 3340/tcp sapgw41 3341/tcp sapgw42 3342/tcp sapgw43 3343/tcp sapgw44 3344/tcp sapgw45 3345/tcp sapgw46 3346/tcp sapgw47 3347/tcp sapgw48 3348/tcp sapgw49 3349/tcp sapgw50 3350/tcp sapgw51 3351/tcp sapgw52 3352/tcp sapgw53 3353/tcp sapgw54 3354/tcp sapgw55 3355/tcp sapgw56 3356/tcp sapgw57 3357/tcp sapgw58 3358/tcp sapgw59 3359/tcp sapgw60 3360/tcp sapgw61 3361/tcp sapgw62 3362/tcp sapgw63 3363/tcp sapgw64 3364/tcp sapgw65 3365/tcp sapgw66 3366/tcp sapgw67 3367/tcp sapgw68 3368/tcp sapgw69 3369/tcp sapgw70 3370/tcp sapgw71 3371/tcp sapgw72 3372/tcp sapgw73 3373/tcp sapgw74 3374/tcp sapgw75 3375/tcp sapgw76 3376/tcp sapgw77 3377/tcp sapgw78 3378/tcp sapgw79 3379/tcp sapgw80 3380/tcp sapgw81 3381/tcp sapgw82 3382/tcp sapgw83 3383/tcp sapgw84 3384/tcp sapgw85 3385/tcp sapgw86 3386/tcp sapgw87 3387/tcp sapgw88 3388/tcp sapgw89 3389/tcp sapgw90 3390/tcp sapgw91 3391/tcp sapgw92 3392/tcp sapgw93 3393/tcp sapgw94 3394/tcp sapgw95 3395/tcp sapgw96 3396/tcp sapgw97 3397/tcp sapgw98 3398/tcp sapgw99 3399/tcp
- Save the file and restart your application (rebooting the machine shouldn’t be required)
Strictly speaking, you should only really one or two of these—the one that corresponds to your SAP system—but I don’t think it hurts anything to have them all in there.
Other Things To Try
If that doesn’t fix it, you might also make sure you’re using a hostname (not an IP address) and that you are using the right connection for your situation (ashost/application server host vs. message server host else there is).
I also stumbled across a user reporting an issue with tabs vs. spaces. I’ve not had any trouble with spaces but your mileage may vary.