Web Service contains DLL running over Visual Studio 2005 Fine but over IIS 7.5 doesn't work

Locked Web Service contains DLL running over Visual Studio 2005 Fine but over IIS 7.5 doesn't work

  • Wednesday, April 04, 2012 11:49 AM
     
     

    Machine Description :-

    Windows server 2008

    64 bit

    Visual Studio 2005

    DLL Created by using Gupta

    already registerd but not work when i call it from IIS Server but when i call it from Visual Studio works fine so can you help me for solving this issue ?


All Replies

  • Wednesday, April 04, 2012 12:21 PM
     
     

    Hello Ibrahim, you probably need to enable 32 bit applications in your Application Pool. To do that, go to the application pool of your IIS site, go to advance configuration, and set to True Enable 32 bit applications.

    Hope this helps,

    Miguel.

  • Wednesday, April 04, 2012 12:40 PM
     
     

    Hi Miguel ,

    actually i enabled it but still doesn't Work .

    I already  up it to Windows server 2003 and it works fine , but in windows server 2008 and also IIS 7.5 i think there something in IIS Version   Or web server

    you can think and give me some ideas my solve it .

    Ibrahim

  • Wednesday, April 04, 2012 12:45 PM
     
     

    Hello again, which what version of the .NET framework is made your web service? The dll you use is a .NET assembly or a native code library? Are you using PInvoke in any part of your web service or dll? If your dll is a .NET assembly for what target was compiled (AnyCPU, x86...)?

    Regards,

    Miguel.

  • Wednesday, April 04, 2012 12:54 PM
     
     

    Hello Miguel ,

    Thanks for Replay , about description :

     - DLL extract from Gupta (Team Developer ) not Dot net Assembly .

     - DLL is a native Code .

     - I add this DLL to web service using Add reference and then add it .

     - Web service Dot Net framework is 2 and i using it in IIS .

     - What do you mean about "Are you using PInvoke in any part of your web service or dll?" ?

    Ibrahim

  • Wednesday, April 04, 2012 12:57 PM
     
     

    Hello, PInvoke is the action to call native code from your .NET assemblies, using the attribute DllImportAttribute.

    Are you using it?

    Regards,

    Miguel.

  • Wednesday, April 04, 2012 1:17 PM
     
     

    No i'm not using it so what will you think about ?

  • Wednesday, April 04, 2012 1:25 PM
     
     

    What is the error your web service client are receiving?

    You can try reregistering asp.net 2.0 in IIS:

    http://msdn.microsoft.com/en-us/library/k6h9cz8h(v=vs.80).aspx

    Your AppPool need to be set to .NET v2.

    And your IIS should have registered the asmx extension to work.

    Remember always to restart the server when you change the configuration in order to avoid problems.

    Regards,

    Miguel.

  • Wednesday, April 04, 2012 1:34 PM
     
     

    Miguel ,

    All Operations done webservice Work so nicely and opened in Browser in a good state but when i INVOKE any class that connect to DLL here is the problem

    when i clicked any Class Invoking then it opens to me a new browser Page Loading infinity ,it's load doesn't end , i think IIS trying to connect to Sybase Datbase through DLL but doesn't Succed .

    But When i run Webservice Using Visual studio it Works Fine .

    is there is any Problem on IIS WebServer .

    Ibrahim

  • Wednesday, April 04, 2012 2:23 PM
     
     

    Hello, maybe the Gupta library has some dependencies that you have in your development machine but not in the web server machine or you are using the same machine?

    Can you post me a link to download that library?

    Regards,

    Miguel.

  • Wednesday, April 04, 2012 2:45 PM
     
     

    I'm already using the same Machine

    Please Send to me you mail address to send DLL Library

  • Wednesday, April 04, 2012 3:34 PM
     
     

    My mail address is mfcorral@gmail.com.

  • Wednesday, April 04, 2012 6:21 PM
     
     

    Hello again, I inspected the Dll and you need to use COM interop (typelib) to access its functionality. If your web service works fine in VS but not in IIS I think the problem is that the library is for 32 Bits, while your web service for sure is published as AnyCPU. Try to change the web service project target to x86 (Project properties -> Build -> Target platform -> x86), compile it, publish it again in the IIS, restart the IIS server and check it again (enabling the 32 bit applications in the application pool of your web service).

    Let me know the results.

    Miguel.

  • Thursday, April 05, 2012 9:36 AM
     
     

    Hello Miguel ,

      You are a good mind friend ,Please i oen this webservice using open Website fron VS2005 and I run it as a website note aweb application

    Website Doesn't Contain Build Tab . so what will i do ?

    And when i convert it as web application doesn't work and there is error i see it before  : --

    [BadImageFormatException: Could not load file or assembly 'WebApplication6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
       System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
       System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
       System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

    [ConfigurationErrorsException: Could not load file or assembly 'WebApplication6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
       System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
       System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +600
       System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
       System.Web.Compilation.BuildManager.CompileCodeDirectories() +265
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +320

    [HttpException (0x80004005): Could not load file or assembly 'WebApplication6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

    [HttpException (0x80004005): Could not load file or assembly 'WebApplication6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8913739
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

  • Thursday, April 05, 2012 2:16 PM
     
     Answered

    Hello again Ibrahim, you have the following problem:

    - You have a 64 bit Windows

    - Your application is made with VS 2005 using .NET 2.0 and you are using 3rd party C++ 32 bit library/ies in your application. Inside the VS 2005, during debugging you have not problems because the VS 2005 and the Debug Web Server are both 32 bit applications, then they don't have any problem to call C++ 32 bit libraries or create COM objects from a 32 bit COM server as your case.

    - The issue starts inside IIS that is a 64 bit application. You try to run the same web application inside a 64 bit process. You need to explicity configure your web application to use 32 bit code (is for that you are receiving a BadImageException, IIS spects PE32+ format instead of PE32).

    - Please, create a new Application Pool:

    And go to the advanced properies and enable 32 bit applications:

    Sorry for the spanish interface, I dont have the ability to get a server in English UI.

    Then set this application pool to your web application and restart the IIS. But remember first to change your VS 2005 web project target to 32 bit (x86) instead of AnyCPU (the default).

    Regards,

    Miguel.