我有一个使用免费Windows许可证的基本Windows应用程序。
在作为Web项目运行时,我能够成功地执行查询。
但是,当使用ServerConsole.exe托管时,我会得到以下异常:
没有侦听
http://localhost:63191/EntityService.svc/winrt的端点可以接受来自此应用程序的调用。如果在Visual中运行,请确保为web项目中的所有CopyLocal=true程序集引用设置IdeaBlade,以确保将这些程序集复制到bin文件夹。还要检查global.asax是否包含注册DevForce VirtualPathProvider的代码,或者是否存在EntityService.svc和EntityServer.svc文件。 若要检查服务是否正在运行,请打开internet浏览器并导航到http://localhost:63191/EntityService.svc。如果服务页显示错误,这些错误将有助于诊断服务的问题。如果服务正在运行,那么还要确保客户端和服务器之间的端点绑定匹配,并且服务器的ClientApplicationType对于此客户端是“All”或正确的。有关更多信息,请查看服务器的调试日志文件。
解决方案中有三个项目,App1 (Windows )、DomainModel (NET4.5)和App1.Web ()。ServiceConsole.exe被复制到DomainModel的输出目录中。
ServerConsole正确地报告:
Trying programmatic configuration of EntityService using
ideablade.configuration section EntityService listening on
http://localhost:63191/EntityService/winrt EntityService listening on
http://localhost:63191/EntityService/wp Press <Enter> to exit server.导航到
`http://localhost:63191/EntityService.svc` shows `404 Not Found`.
`http://localhost:63191/EntityService` shows the standard Web Service info page.发布于 2014-08-26 16:47:15
这是由于DevForce中的“异常性”所致。对于移动客户端,默认假设EntityService将由IIS托管,并自动附加WCF所需的.svc扩展。
要解决此问题,可以添加DevForce ServiceProxyEvents类的自定义实现,以去掉扩展并替换URI。
class ClientProxy : IdeaBlade.EntityModel.ServiceProxyEvents
{
public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint endpoint)
{
var olduri = endpoint.Address.Uri;
var newuri = new Uri(olduri.AbsoluteUri.Replace(".svc", string.Empty));
endpoint.Address = new System.ServiceModel.EndpointAddress(newuri);
base.OnEndpointCreated(endpoint);
}
}将类放置在客户端程序集中,由DevForce“探测”。
https://stackoverflow.com/questions/25496153
复制相似问题