简体   繁体   中英

WCF Service as a replacement for ASPX service

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 (eg 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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM