Software House

Software House

  • NA
  • 5
  • 1.6k

The exception message is 'Unable to load DLL 'Final1_dll.dll

Apr 10 2014 8:26 AM
hi i am software engineer. For the last few days I am trying to pass the json format data to the wcf web service using using framework 4.0 and in the service i call the dll which will perform some action on the json data. the dll namely Final1_dll.dll when I check it on the local IIS it's working fine but when I upload this to the server so its give me error of "The exception message is 'Unable to load DLL 'Final1_dll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)".

[DllImport("Final1_dll.dll", CharSet = CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
        public static extern IntPtr PtrReturnAPI02(char[] abc);

public string DemosData(Stream data1) {
            // convert Stream Data to StreamReader
            StreamReader reader = new StreamReader(data1);
            // Read StreamReader data as string
            string xmlString = reader.ReadToEnd();
            if (IsJson(xmlString))
            {
                IntPtr pStr = PtrReturnAPI02(xmlString.ToCharArray());

                string str = Marshal.PtrToStringAnsi(pStr);

                Marshal.FreeHGlobal(pStr);
                pStr = IntPtr.Zero;

                return str;


            }
            else
            { return "Input was not in a correct format."; }

            // PtrReturnAPI02(xmlString.ToCharArray());
            }

        public static bool IsJson(string input)
        {
            input = input.Trim();
            return input.StartsWith("{") && input.EndsWith("}")
                   || input.StartsWith("[") && input.EndsWith("]");
        } 

[ServiceContract]
    interface IManagedCodeService
    {
[OperationContract(Name="DemoData")]
        [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "DemoData")]
        string DemosData(Stream data1);
}
I need some suggestions ASAP. Thanks in advance. 

Answers (4)