WCF Service as a replacement for ASPX service

拟墨画扇 提交于 2019-12-13 07:46:24

问题


Hopefully you will be able to help me with this.

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.

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.

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>

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?

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.

Hopefully this makes sense!


回答1:


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

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

Have a look at :

http://www.eggheadcafe.com/software/aspnet/35496061/deploying-multiple-wcf-services-in-same-iis-virtual-directory.aspx



来源:https://stackoverflow.com/questions/4123764/wcf-service-as-a-replacement-for-aspx-service

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