cancel
Showing results for 
Search instead for 
Did you mean: 

A little big problem with SAP .Net Connection

0 Kudos

I'm beginner integrating .NET with SAP.

I have a little big problem when i try to connect to SAP

from .NET to call RFC's in run time.

I'm working in a local machine with SAP GUI installed

that works very well.

VS .NET 2003 IDE works very well also (into server

explorer i can see the sap app server and navigate throw

functions ¿exported? and draging this to sap proxy

pannel in design time.

But, when I try connect to SAP in run time i get
the following error:

Connect to SAP gateway failed Connect_PM
GWHOST=/H/SAPDES/S/sapgw00/H/SAPDES, GWSERV=sapgw00,
ASHOST=/H/SAPDES/S/sapgw00/H/SAPDES, SYSNR=00 LOCATION
CPIC (TCP/IP) on local host ERROR partner not reached
(host SAPDES, service sapgw00) TIME Wed May 25 12:16:23
2005 RELEASE 620 COMPONENT NI (network interface)
VERSION 36 RC -10 MODULE ninti.c LINE 972 DETAIL 
NiPConnect2 SYSTEM CALL SO_ERROR ERRNO -2147467259 ERRNO
TEXT E_FAIL: Unspecified error CO

Looking at the end of de error report, i can see

the following:

[RfcCommunicationException: Connect to SAP gateway
failed
Connect_PM  GWHOST=/H/SAPDES/S/sapgw00/H/SAPDES,
GWSERV=sapgw00, ASHOST=/H/SAPDES/S/sapgw00/H/SAPDES,
SYSNR=00

LOCATION    CPIC (TCP/IP) on local host
ERROR       partner not reached (host SAPDES, service
sapgw00)

TIME        Wed May 25 12:16:23 2005
RELEASE     620
COMPONENT   NI (network interface)
VERSION     36
RC          -10
MODULE      ninti.c
LINE        972
DETAIL      NiPConnect2
SYSTEM CALL SO_ERROR
ERRNO       -2147467259
ERRNO TEXT  E_FAIL: Unspecified error

When i try a "telnet sapdes sapgw00" it works but
3 or 4 seconds late.

Here my "code":

-

-


Dim myDestination As New Destination

With myDestination
   .Username = myUsername
   .Password = myPasswor
   .SystemNumber = 0
   .Client = 100
   .AppServerHost="/H/SAPDES/S/sapgw00/H/SAPDES"
   .UseSoap = False
End With

Dim ecatProxy As New SAPProxyEcat
ecatProxy.Connection = Connection.GetConnection
(myDestination.ConnectionString)

ecatProxy.Zecat_Test(salida)

-

-


I think that the problem could be the timeout reached

when i try contact the server...

Some sugesttion, please, to resolver this "trouble"?

Thnk.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Silly question, but when you say the application doesn't work as a web app, is the web app running on the same machine?

If it isn't then the services file (port resolution) and dns or system id resolution may not be the same as the machine you tested the windows forms/console app with which would cause the problem.

It's probably a way more complicated problem but thought i'd contribute all the same.

Former Member
0 Kudos

Charles,

The web app and win32 app are being executed on the same machine. Some things looks strange:

- The error has appeared first in my computer (VS2003 framework 1.1, using an older version of .net connector), in an application stable. For no reason, appeared in another computer executing the same webapp that I was running on mine (but this second, using an older version of webapp). And then, in two more computers, but with different webapp projects (all accessing the same SAP). We've point one of these applications to a different SAP server (of another client), but the error was the same. This made us tought the problem was in our network, but we tried to execute a sniffer, listening all outbound connections from my machine, and not even one packet was directed to the SAP destination server.

I've made a workaround that works for a couple of hours:

- Impersonate a user on C# web app web.config(a simple domain user, instead of ASPNET)

- Try to execute pointing the appserverhost to SAPDEV, and call the "open()" method. >> fails

- Change the appserverhost to: "/H/SAPDEV/S/sapgw00/H/OUR_EXTERNAL_IP_ADDRESS/H/" and "open()" again >> fails

- Change the appserverhost to: "/H/SAPDEV/S/sapgw00/H/SAPDEV/H/" and "open()" again >> fails

- Back to SAPDEV, and, I don't know why???, it worked (just for 2-3 hours).

I don't know what I've done above, but misteriously, it worked (at least for a little time).

After the new .Net Connector, the above workaround stopped to work. All connections (ping, telnet on server/sapgw00, form application) still working, but the web applications, don't.

The last windows fix installed was on october (on my computer). And in our server, in september. I don't think that is a problem related to a windows fix installed. But, who knows...

Now, we will try a different webserver (instead of IIS), according to Reiner said "Maybe it is related to some user rights that the IIS user is missing or some policies in the IIS administrator.". In our clients network (the same domain for their sap server that we are trying to access and their iis), the application continues working perfectly on iis.

Anyone have an idea?

Regards,

Douglas Frankenberger

douglas@inflor.com.br

Former Member
0 Kudos

Do you have any firewall/anti-virus software on your machines running the web apps that would prevent outgoing connections from certain processes? Maybe the ASPNET process has been blocked from outgoing communications. A strange situation but possible all the same I guess. It would explain why other processes (your compiled windows forms and console applications) work.

Former Member
0 Kudos

I'm having exactly the same problem... For no reason it stopped to work last week. I've installed .Net connector 2.x (the last version disponible), but its makes no difference. No system changes was made on both sides to justify this error.

The error message (trying to access from a C# web application) was:

"Connect to SAP gateway failed\nConnect_PM GWHOST=SAPDEV, GWSERV=sapgw00, ASHOST=SAPDEV, SYSNR=00\n\nLOCATION CPIC (TCP/IP) on local host\nERROR partner not reached (host SAPDEV, service 3300)\n\nTIME Tue Dec 13 09:21:13 2005\nRELEASE 620\nCOMPONENT NI (network interface)\nVERSION 36\nRC -10\nMODULE ninti.c\nLINE 972\nDETAIL NiPConnect2\nSYSTEM CALL SO_ERROR\nERRNO -2147467259\nERRNO TEXT E_FAIL: Unspecified error \nCOUNTER 8\n" string

The same application (accessing the same resources), from a Windows Forms application, works without any kind of problems.

Thanks for any help!

Douglas Frankenberger

douglas@inflor.com.br

reiner_hille-doering
Active Contributor
0 Kudos

I could only explain this problem if some Microsoft fix(or other tool like Firewall) prevents the IIS process to create a TCP connection to SAP server. Maybe it is related to some user rights that the IIS user is missing or some policies in the IIS administrator.

I would suggest trying to repro the problem without NCo, e.g. with a small Web Site that tries to create a Socket connection to SAPDEV, port 3300.

0 Kudos

Thk for the help, but the problem remains..

My vb code works very well when i'm deploying windows forms or console applications, but doesn't when i'm deploying a web application.

Should I initializer something before connecting to SAP via .NET Connector? (like a DLL or other component rather than the connection parameters to SAP?)

Thk!

Former Member
0 Kudos

Hi,

can you please copy the new error message after applying the code change suugested above?

If the .NET Connector runtime (SAP.Connector.dll, SAP.Connector.Rfc.dll, librfc32.dll) has been correctly installed on the IIS machine, no additional initialization is required.

Regards,

Guangwei

Former Member
0 Kudos

> Dim myDestination As New Destination

>

> With myDestination

> .Username = myUsername

> .Password = myPasswor

> .SystemNumber = 0

> .Client = 100

> .AppServerHost="/H/SAPDES/S/sapgw00/H/SAPDES"

> .UseSoap = False

> End With

>

> Dim ecatProxy As New SAPProxyEcat

> ecatProxy.Connection = Connection.GetConnection

> (myDestination.ConnectionString)

hi

Have you try using the IP address. eg : X.X.X.X instead of the SAP server name

Add & change syntax in your code

NOTE: DNS_IP_ADDRESS is your DNS IP address

With myDestination

.Username = myUsername

.Password = myPasswor

.SystemNumber = 0

.Client = 100

.AppServerHost="SAPDES" or "IP address: X.X.X.X"

.SAPRouterString = "/H/DNS_IP_ADDRESS/S/sapgw00/H/"

End With

Another method most commonly use is the standard SAP Proxy destination and drag into your application dialog screen. just specify the appserverhost, saprouterstring, password, client, userid and system number.

Hope that these help.

regard,

Former Member
0 Kudos

Hello,

"/H/SAPDES/S/sapgw00/H/SAPDES" looks pretty strange and makes no sense. Please simply try this:

.sername = myUsername

.Password = myPasswor

.SystemNumber = 0

.Client = 100

.AppServerHost="SAPDES"

Regards,

Guangwei

0 Kudos

I did discover that the problem occurrs when

I am depploying web aplicatios.

The same code into a console or windows form works well,

but doesn't into a web application.

Does anybody know the reason why?

Thk.