简体   繁体   中英

Creating web interface for WCF service

I have two projects right now - a WCF service that pulls from a database, and an ASP.NET project with AngularJS that acts as the interface. My question - is there a way to combine the two into a single project? What I would like to happen: when running the WCF service, my interface should appear in the browser instead of the traditional XML page. I know it's possible to stick the service's dll into the interface's file structure, but I want the interface to be within the service, not the other way around. Is this possible? Does anyone know how this might be done? Thanks in advance!

Yes, you can combine WCF and ASP.NET projects into a single project. Just ensure to add all your references from WCF project to ASP.NET project and also any web.config files settings.

Can you provide more information on the 2nd part of the question, " my interface should appear in the browser instead of the traditional XML page"?

I'm going to strongly suggest keeping two projects. It's generally considered good architecture to build software in logical layers. In your case, you have a Business/Data-Access layer and a Presentation layer. Very common. Merging them would be a mistake! You would certainly wind up with crossed concerns over time; while if you keep them separate, you will have testable layers.

Additionally, it's often a good idea to separate your interfaces into yet another project, such that all others depend on it as the infrastructure or skeleton of the whole solution.

Layered architecture reference: https://msdn.microsoft.com/en-us/library/ee658109.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