WCF服务作为服务ASPX更换 [英] WCF Service as a replacement for ASPX service

查看:121
本文介绍了WCF服务作为服务ASPX更换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望你可以帮我这个问题。

Hopefully you will be able to help me with this.

我一直有兴趣开发一个n层的Web应用程序,用户界面​​ - WCF服务 - 实体框架数据层,使我的数据层是不是直接从Web应用程序访问

I have been interested in developing a n-tier web app, UI - WCF Service - Entity Framework Data Layer, so that my datalayer is not directly access from the web app.

我已经建立了我的数据层,WCF服务和Web应用程序都在包含在一个解决方案中自己的项目,我能够在服务引用(WCF服务)添加到Web应用程序。

I have created my data layer, WCF service and web app all in their own projects contained within one solution, and I am able to add a Service Reference (WCF Service) to the web app.

这一切工作正常,我理解它是如何工作。但是我在我怎么会在一个工作环境中部署这种困惑?运行解决方案时在其自己的域/端口:(58307例如本地主机),然后我的web应用程序目前,Web应用程序有一个服务参考在测试环境中自己的域/端口内自动打开了WCF服务。
在Web应用程序,在web.config则包含了&LT一个新的部分; system.serviceModel>

This all works fine, and I understand how it all works. However I am confused at how I would deploy this in a working environment? Currently, the web app has a service reference to the WCF service which in the test environment automatically opens up within its own domain/port (e.g. localhost:58307), then my web app in its own domain/port when running the solution. In the web app, the web.config then contains a new section for <system.serviceModel> with:

<client>
    <endpoint address="http://localhost:58307/EstkService.svc" binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding_IEstk" contract="EstkService.IEstk"
            name="WSHttpBinding_IEstk">
    <identity>
         <dns value="localhost" />
    </identity>
    </endpoint>
</client>

我将如何去创造我的WCF服务,但是从同一个域中的Web应用程序中引用这个?所以,当我发布项目,我并不需要创建它承载WCF服务的虚拟目录?

How would I go about creating my WCF Service, but referencing this from within the same domain as the web app? So that when I publish the project, I do not need to create a virtual directory which hosts the WCF service?

我给这家的理由是,我是一个共享的托管环境中工作,所以我无法创建WCF服务为IIS中的单独的应用程序。

My reasoning for this is that I am working within a shared hosting environment, so I am unable to create the WCF Service as a separate Application in IIS.

希望这是有道理的!

推荐答案

您只需要端点配置更改为相同的IIS所使用的Web应用程序虚拟目录。

you just need change the endpoint configuration to the same IIS virtual directory that is used by the Web Application.

但WCF应该有它自己的虚拟目录,也许它应该根据不同的应用A池中运行

but the WCF should have it's own virtual directory and maybe it should run under a different applicatio pool

有一个看看:

<一个href=\"http://www.eggheadcafe.com/software/aspnet/35496061/deploying-multiple-wcf-services-in-same-iis-virtual-directory.aspx\" rel=\"nofollow\">http://www.eggheadcafe.com/software/aspnet/35496061/deploying-multiple-wcf-services-in-same-iis-virtual-directory.aspx

这篇关于WCF服务作为服务ASPX更换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆