使用 Service Fabric 模板时出现错误的 dll 文件异常
Bad dll file exception when using the Service Fabric template
客户端中的 Microsoft.ServiceFabric.Actors.dll 文件存在问题。
当我们使用 Service Fabric 模板创建项目时,dll 文件存在于服务中,但不存在于客户端中,然后我们尝试从客户端项目中引用该 dll 文件,当我们 运行 客户端时,我们得到:
An unhandled exception of type 'System.BadImageFormatException'
occurred in mscorlib.dll
Additional information: Could not load file
or assembly 'Microsoft.ServiceFabric.Actors, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
有没有人对 dll 文件有同样的问题,如果有,我们应该如何解决?
Service Fabric 仅为 x64,因此请确保您使用的不是 32 位。
我在 Service Fabric 应用程序之外使用客户端时收到同样的错误。确保您的客户端项目是为 x64 平台构建的。
请按照以下步骤操作:
1. 右键单击您的客户端项目并转到 'Properties'.
2. 在 'Build' 选项卡上,将 'Platform target' 设置为 x64。
3. 构建您的项目并使用客户端。
客户端中的 Microsoft.ServiceFabric.Actors.dll 文件存在问题。 当我们使用 Service Fabric 模板创建项目时,dll 文件存在于服务中,但不存在于客户端中,然后我们尝试从客户端项目中引用该 dll 文件,当我们 运行 客户端时,我们得到:
An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll Additional information: Could not load file or assembly 'Microsoft.ServiceFabric.Actors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format.
有没有人对 dll 文件有同样的问题,如果有,我们应该如何解决?
Service Fabric 仅为 x64,因此请确保您使用的不是 32 位。
我在 Service Fabric 应用程序之外使用客户端时收到同样的错误。确保您的客户端项目是为 x64 平台构建的。
请按照以下步骤操作:
1. 右键单击您的客户端项目并转到 'Properties'.
2. 在 'Build' 选项卡上,将 'Platform target' 设置为 x64。
3. 构建您的项目并使用客户端。