on 02-04-2013 4:35 PM
Trying to run this via asp.net. When I run it via a console application, it works like a champ. Same code throws the above error when trying to access via a web page.
I've tried Visual Studio 2012 - setting the target CPU to x86 for all libs. Same result.
Like above, I also targeted x64. Same result.
Tried IIS7 - Same result.
Tried changing the app pool to 32 bit application. Same result.
Referenced dlls:
sapnco
sapnco_utils
rscp4n
What am I missing?
ANYTHING would be appreciated at this point.
Thanks.
Sean
I had this same problem.
I fixed it by removing this DLL from my build.
Instead I used the sapnco.dll from the nuget package.
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Yes I lost some hours on this too, x86 v x64 dll hell type issues are a real pain. My problem is that my dev environment is 32bit and the prod server IIS 7.5 is 64bit. Evil bosses won't give me a proper dev machine
I have the x86 SAP_DotNetConnector3_x86 libs installed on local dev machine. The following steps were necessary to deploy successfully to IIS 7.5 64bit.
1) Install the 64bit version of the SAP_DotNetConnector on the target server.
2) In VS Build Config Manager target any CPU .
3) In VS project references, right click the 3 SAP dlls and ensure you Copy to Local = true
4) Build project and copy local bin folder to server bin folder
5) Now copy the 64bit dlls installed on the server over the local dlls in the server bin folder
Job done. Note I didn't need to set the AppPool to classic mode or enable 32bit apps for this solution to work. Bonus!
I can get back to SAP Script form now
If this post helps you, please give it a like. Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi to all.
I just had the same problem and cost me almost one day to solve, but, this is my solution:
Case Ahr post , helped me get to the solution.
My Dev computer is x86, my test server is x64
First, I changed the sapnco dll's from x86 to x64 on the server, did not work.
Added rscp4n to the bin directory, did not work,
I found on SCN a prerequisite, Visual C++ Redistributable, so I installed the 2008 and 2010, for x86 nad x64. I think the correct was 2010 x86 or 2008 x86, not sure in this one.
Removed rscp4n, the error changed to sapnco not loaded.
After all this the problem was still present,
Then, Case Ahr post help me, and I notice my sapnco dll was x64, but all my development is x86, so I changed back to x86, and change the destination CPU to x86 con my projetc
and the problem was solved.
I think the only problem from start was the missing visual C++ 2010 or 2008
Hope this helps any one with the same problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sean,
is the error message you posted complete? Normally it continues with a reason, e.g. "File not found", "Invalid parameter" ....
Did you try to purge the .NET Temporary files as suggested here:
c# - After a computer crash my Visual Studio 2010 will not load an assembly - Stack Overflow
Hynek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem in Visual studio 2010, my application does work very well like a desktop application and like a console application, But I need web application ASP.NET with Visual studio 2010
And when I try to run, show error below:
Could not load file or assembly 'rscp4n' or one of its dependencies.
Could you please help me? I have SAP_DotNetConnector3_x86
And If I run muy web application from visual studio 2010 does work very well but when I publish this website in my IIS localhost. show the error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luis/Sean- Did any of you end up finding a solution to this issue? I am having a very simialr issue with these dlls on the ASP .NET C# application on Visual Studio 2010. I am not even able to execute this from VS in the debug mode. Like you said, I have a console app in C# working just fine without any issues... I would really appreciate if you can let me know how you fixed this issue.
Thanks
Renjith
Unfortunately, the support from SAP on the SAP .NET Connector 3.0 is poor to non-existent. I also have this same issue. I'm actually looking into using the Biztalk SAP Adapter 2010 pack to connect to SAP, instead of the SAP version. A lot more examples using the Biztalk Adapter, and there's actual support.
Three things:
Imports System.Reflection
Imports System.IO
Imports System.Runtime.InteropServices
Module Module1
Public Sub Main()
Dim args As New List(Of String)
args.Add("C:\YOURASPPROJECT\bin")
If args.Count <> 1 Then
Console.WriteLine("Usage: <directory to test for dlls>")
Finished()
Else
Dim dir = args(0)
Console.WriteLine("Reading from ""{0}"" -- press any key to continue, or ""x"" to cancel...", dir)
If Console.ReadKey().KeyChar.Equals("x"c) Then
End
Else
Console.WriteLine()
Console.WriteLine("This machine is {0}", If(Is64BitOperatingSystem, "64 bit", "32 bit"))
Console.WriteLine()
For Each file As Object In Directory.EnumerateFiles(dir)
If Path.GetExtension(file) = ".dll" OrElse Path.GetExtension(file) = ".exe" Then
Try
Dim assembly__1 As Assembly = Assembly.ReflectionOnlyLoadFrom(file)
Dim kinds As PortableExecutableKinds
Dim imgFileMachine As ImageFileMachine
assembly__1.ManifestModule.GetPEKind(kinds, imgFileMachine)
Console.WriteLine("{0,-40} - {1,-15} - {2, -10}", Path.GetFileName(file), imgFileMachine, kinds)
Catch ex As Exception
Dim err = "error"
If ex.Message.Contains("The module was expected to contain an assembly manifest.") Then
err = "native"
End If
Console.WriteLine("{0,-40} - {1,-15}", Path.GetFileName(file), err)
End Try
End If
Next
Finished()
End If
End If
End Sub
Private Sub Finished()
Console.WriteLine("Press a key to exit...")
Console.ReadKey()
End Sub
Public ReadOnly Property Is64BitOperatingSystem() As Boolean
Get
' Clearly if this is a 64-bit process we must be on a 64-bit OS.
If IntPtr.Size = 8 Then
Return True
End If
' Ok, so we are a 32-bit process, but is the OS 64-bit?
' If we are running under Wow64 than the OS is 64-bit.
Dim isWow64 As Boolean
Return ModuleContainsFunction("kernel32.dll", "IsWow64Process") AndAlso IsWow64Process(GetCurrentProcess(), isWow64) AndAlso isWow64
End Get
End Property
Private Function ModuleContainsFunction(moduleName As String, methodName As String) As Boolean
Dim hModule As IntPtr = GetModuleHandle(moduleName)
If hModule <> IntPtr.Zero Then
Return GetProcAddress(hModule, methodName) <> IntPtr.Zero
End If
Return False
End Function
<DllImport("kernel32.dll", SetLastError:=True)> _
Private Function IsWow64Process(hProcess As IntPtr, <MarshalAs(UnmanagedType.Bool)> ByRef isWow64 As Boolean) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Function GetCurrentProcess() As IntPtr
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Auto)> _
Private Function GetModuleHandle(moduleName As String) As IntPtr
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Ansi, SetLastError:=True)> _
Private Function GetProcAddress(hModule As IntPtr, methodName As String) As IntPtr
End Function
End Module
One additional remark: rscp4n.dll is only needed in case you need to use the USE_SAP_CODEPAGES parameter. Details when to use it can be found in the API documentation for
RfcConfigParameters.UseSAPCodepages. In all other cases you can omit it. However, it does not have additional dependencies compared to the sapnco.dll, hence Case's recommendations should be sufficient.
Best regards,
Markus
Do you mean to say that if I open a ticket, SAP will send me sample code on how to send an iDoc using the new SAP .NET Connector 3.0?
This is really what I am looking for. It really seems like quite a step back for the new SAP .NET Connector 3.0 to not be able to do what the 2.0 version was able to do.
Does anyone have any sample code on how to SEND an iDoc with the new SAP.NET Connector 3.0?
Hello George,
what you like to get is consulting, this not always covered by the support contracts, but you can for sure request consulting or EOD in case it is not. Support is supposed to resolve bugs found by customers and to provide them fixes.
And actually, the IDoc support in NCo 2.0 was really a very rudimentary one it was simply a special handler for the function module used by IDocs - all the difficult things are not present. Therefore it did not make sense to include this part, which everybody could simply add in a simple server function / call to a destination himself in NCo 3.0. What you obviously like to have is an IDocLibrary for .NET like it exists for Java on top of JCo 3.0. But at the point in time NCo 3.0 was in development, this was not requested by any stakeholder.
Best regards,
Markus
Make sure you restart the app pool afterwards. Also, try Classic instead of integrated pipeline.
Also, I would recommend the Target CPU stay at "Any CPU."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, I tried those ideas as well with no luck.
I thought it may be a rights issue on the location where the sap dll's are, but I gave all users full rights to that folder and still no change. I also gave full rights to the Temporary ASP.Net files folder with no luck.
This occurs both through IIS as well as Visual Studio 2012.
I also just created a totally blank asp.net web application and ran the default page. This loaded fine. I simply added the 3 sap .net connect dll's to the project and rebuilt(successful) then tried to browse the page again and the error shows up - no references are made to the libraries in the code.
Don't know if that helps or not?
Any other ideas?
Thanks.
Sean
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.