Po uruchomieniu Microsoft Visual Studio, utwórz standardową "Bibliotekę usług WCF" i skompiluj ją, działa idealnie.Nie mogę skompilować standardowej "Biblioteki usługi WCF" w formacie x86
Jednakże, jeśli wejdę w Właściwości ... Buduj i ustawię "Cel platformy" na "x86", to nie zostanie skompilowane. Potrzebuję "x86", ponieważ muszę odwołać się do niektórych .dll, które po prostu nie zadziałają, jeśli wybiorę "Wszystkie platformy".
-----start error-----
System.BadImageFormatException: Could not load file or assembly 'file:///D:\backtest\C#\WCF service\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'file:///D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)
=== Pre-bind state information ===
LOG: User = dr-satellite\Shane
LOG: Where-ref bind. Location = D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll
LOG: Appbase = file:///D:/backtest/C#/WCF service for/WcfServiceLibrary/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///D:/backtest/C#/WCF service for/WcfServiceLibrary/bin/Debug/WcfServiceLibrary.dll.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
-----end error-----
Masz na myśli "Usługa WCF" _Biblioteka "(ponieważ nie będzie budować w trybie 32-bitowym), ...." ??? – Steve
Wierzę, że prawdziwym problemem jest to, że _Service Libraries_ (i wszystkie ich zależności) musi działać w natywnej architekturze ich hosta, która prawdopodobnie jest domyślnie twoim systemem operacyjnym. Dlatego tak, jeśli chcesz uruchomić x86 na komputerze z procesorem x64, to tak, aby aplikacja _WCF Service_ *** *** była rozwiązaniem. *** – Adam
@Steve Podziękowania Poprawiony post. – Contango