Bad dll file exception when using the Service Fabric template

别来无恙 提交于 2019-12-10 16:49:51

问题


We are having an issue with Microsoft.ServiceFabric.Actors.dll file in client. When we created the project using the Service Fabric template, the dll file exists in Service, but not in client, then we tried to reference that dll file from the client project, when we run the client, we got:

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.

Has anyone had the same issue with dll file, and if so, how should we fix it?


回答1:


I received the same error when using a client outside of the Service Fabric Application. Make sure your client project is built for the x64 platform.

Follow these steps:
1. Right click on your client project and go to 'Properties'.
2. On the 'Build' tab, set your 'Platform target' to x64.
3. Build your project and use the client.




回答2:


Service Fabric is x64 only, so make sure you're not using 32-bit.



来源:https://stackoverflow.com/questions/35656598/bad-dll-file-exception-when-using-the-service-fabric-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!