I can't compile a standard “WCF Service Library” in x86 format

前端 未结 2 1279
夕颜
夕颜 2020-12-09 05:48

If I start up Microsoft Visual Studio, create a standard \"WCF Service Library\", and compile it, it works perfectly.

However, if I go into Properties..Build and set

2条回答
  •  盖世英雄少女心
    2020-12-09 06:42

    Your problem is actually the WCF Test Client complaining that your WCF Service Library is 32bit. This is because by default, the WCF Test Client always runs in 64 bit mode.

    Rather than going to the lengths of changing to a WCF Service Application so you can debug, I found the following steps on this blog which makes the WCF Test Client run in 32bit mode - and therefore you will not see the error you have posted.

    1. Copy WcfSvcHost.exe and WcfTestClient.exe from C:\program files (x86)\Microsoft Visual Studio 10.0\Common7\IDE to a local directory. Keep a backup copy of this file, of course.
    2. Start a Visual Studio 2010 Command Prompt (one of the links from the start menu -> Visaul Studio 2010)
    3. "cd" to the directory where your copy of WcfSvcHost is located.

    4. Execute the command "corflags /32BIT+ /FORCE WcfSvcHost.exe"

    5. Execute the command "corflags /32BIT+ /FORCE WcfTestClient"

    6. Copy the files back to where you found it.

    Now your WcfSvcHost and WcfTestClient will be running in 32 bit mode, and you can debug away!

提交回复
热议问题