我有一个WPF应用程序,我希望将其作为独立部署,以便用户可以从网站下载并运行它而无需安装它。
它运行正常(来自任何机器),只要它包含调试文件夹中的所有文件:
如果我尝试在没有其他文件的情况下运行EXE,如果崩溃了。有没有办法可以将这些文件简化为EXE,以便它可以独立运行?
(表单上有一个背景图片,但这被设置为Build Action = Resource,所以我不认为这是问题。此外,图片不必按顺序复制到其他机器运行,只显示上面显示的文件。) 事件日志中的错误是:
Faulting application name: AMBootstrapper.exe, version: 1.0.0.0, time stamp: 0x572caffc
Faulting module name: KERNELBASE.dll, version: 10.0.10586.162, time stamp: 0x56cd55ab
Exception code: 0xe0434352
和
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
编辑:经过更多测试后,我可以删除大部分文件,但我不能 AMBootStrapper.exe.config
答案 0 :(得分:1)
根据@BenJackson,问题在于WCF服务详细信息位于应用配置中。
解决方法是从app.config中删除它:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" allowCookies="true" maxReceivedMessageSize="184320" maxBufferPoolSize="184320" >
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://svc.myserver.com/MyService/Service.svc/Service.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService"
contract="MyService.IService" name="WSHttpBinding_IService" />
</client>
</system.serviceModel>
在代码中替换为:
WSHttpBinding binding = new WSHttpBinding();
binding.AllowCookies = true;
binding.MaxBufferPoolSize = 184320;
binding.MaxReceivedMessageSize = 183420;
binding.Security.Mode = SecurityMode.Transport;
EndpointAddress address = new EndpointAddress("https://svc.myserver.com/MyService/Service.svc/Service.svc");
MyService.MyClient c = new MyService.MyClient(binding, address);