0

我有一个使用免费 Windows Store 许可证的基本 DevForce Windows Store 应用程序。

当作为 Web 项目运行时,我能够成功地成功执行查询。

但是,当使用 ServerConsole.exe 托管时,出现以下异常:

没有 http://localhost:63191/EntityService.svc/winrt可以接受来自此应用程序的调用的端点监听。如果在 Visual Studio 中运行,请确保为 Web 项目中的所有 IdeaBlade 程序集引用设置 CopyLocal=true,以确保将这些程序集复制到 bin 文件夹。还要检查 global.asax 是否包含注册 DevForce VirtualPathProvider 的代码,或者是否存在 EntityService.svc 和 EntityServer.svc 文件。
要检查服务是否正在运行,请打开您的 Internet 浏览器并导航到http://localhost:63191/EntityService.svc. 如果服务页面显示错误,这些应该有助于诊断服务问题。如果服务正在运行,那么还要确保客户端和服务器之间的端点绑定匹配,并且服务器的 ClientApplicationType 是“全部”或对于该客户端是正确的。检查服务器的调试日志文件以获取更多信息。

解决方案中有三个项目,App1(Windows 应用商店)、DomainModel(NET4.5)和 App1.Web(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.
4

1 回答 1

1

这是由于 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“探测”的客户端程序集中。

于 2014-08-26T16:47:15.643 回答