c# - .NET 4.0 项目无法在 Windows xp 上运行

标签 c# .net wcf .net-4.0

我有一个程序正在 Windows 7 64 位计算机上使用 Visual Studio 2013 开发。我将我的项目设置为以 Framework 4.0 为目标,并将我的平台目标设置为 x86。我可以让它在我的 64 位和带有 .NET 4.0 的 Win 7 32 位机器上构建和运行,但它不会在 XP 上运行。

我正在使用 BCL Portability Pack 和 Microsoft Async NuGet 包。我已经在 XP 上安装了 .NET 4.0 的 KB2468871 更新。

我还运行了 Fusion 数据记录器并收到了这个:

*** Assembly Binder Log Entry  (3/14/2014 @ 9:18:05 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  U:\All_Access\UserName\iBEdit\iBedit64Forms\bin\Release\IBEdit.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = USER
LOG: DisplayName = IBEdit.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///U:/All_Access/UserName/iBEdit/iBedit64Forms/bin/Release/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = IBEdit.exe
Calling assembly : IBEdit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: U:\All_Access\UserName\iBEdit\iBedit64Forms\bin\Release\IBEdit.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///U:/All_Access/UserName/iBEdit/iBedit64Forms/bin/Release/en/IBEdit.resources.DLL.
LOG: Attempting download of new URL file:///U:/All_Access/UserName/iBEdit/iBedit64Forms/bin/Release/en/IBEdit.resources/IBEdit.resources.DLL.
LOG: Attempting download of new URL file:///U:/All_Access/UserName/iBEdit/iBedit64Forms/bin/Release/en/IBEdit.resources.EXE.
LOG: Attempting download of new URL file:///U:/All_Access/UserName/iBEdit/iBedit64Forms/bin/Release/en/IBEdit.resources/IBEdit.resources.EXE.
LOG: All probing URLs attempted and failed.

我项目的“Release”文件夹中没有“en”文件夹。这会引起问题吗?它为什么要看那里?

我还需要对我的项目进行任何其他更改吗?

更新:

没有给出异常,只是消息:“iBEdit 遇到问题需要关闭”

这是 AppConfig 代码:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="SpecSrvSoapBinding"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://example.com/TCheckWebServices/services/SpecSrv" binding="basicHttpBinding" bindingConfiguration="SpecSrvSoapBinding" contract="DBService.SpecSrv" name="SpecSrv"/>
        </client>
    </system.serviceModel>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0"/>
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

更新 2:

不是真的成功,但我已经说服管理层,尝试开发此应用程序以与 XP 一起使用是一种浪费,他们应该让我集中精力将我们的机器升级到 Windows 7。

最佳答案

您尝试从 app.config 加载的内容导致了此问题。

也许 app.config 中的文件位置在您的 XP 机器中不存在。

无论如何,这看起来 .Net 4.0 对 XP 问题的支持。
它看起来像是来自您的代码 - 而不是来自 .NET“信封”。

很抱歉回答这么短,
但是,如果您不打算显示任何相关的实际代码 - 这是我能做的最好的。

更新(看到你的配置后):

---> <binding name="SpecSrvSoapBinding"/>我认为这是在 XP 机器上加载失败的原因。

要对此进行验证 - 在 app.config 中标记这部分并标记所有使用该部分的代码,然后尝试查看是否再次出现相同的错误。

关于c# - .NET 4.0 项目无法在 Windows xp 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22408448/

相关文章:

c# - 是否可以通过 Wcftest 客户端测试 WCF throttle 行为?

wcf - Windows 8 Azure 模拟器正在将端口 80 重新映射到 81

c# - SQL 性能、.Net 优化与最佳实践

c# - ASP.NET IAuthorizationFilter OnAuthorization

c# - 微软公司

c# - 为什么 C# 编译器不自动推断此代码中的类型?

c# - 数据传输对象 - 在 DTO 或业务对象中进行映射?

c# - 类型存在于 2 个程序集中

c# - 匹配两个不同的字母

c# - GUID 是(临时)加密的好 key 吗?