开发者

How to connect two ASP.NET applications (backend and frontend)

开发者 https://www.devze.com 2023-04-05 10:43 出处:网络
I have two ASP.NET applications: the first is backend app made with WebFroms, the second is my frontend app written in MVC. Both apps are sharing the same database. I have problem with frontend media

I have two ASP.NET applications: the first is backend app made with WebFroms, the second is my frontend app written in MVC. Both apps are sharing the same database. I have problem with frontend media files. I want to manage those files in MVC Con开发者_如何学编程tent folder from my backend WebForms app and i can't find way to connect paths.

Is there any correct pattern to do such thing? Or maybe my conception is wrong?


Assuming the applications are on the same server you can map the paths using a virtual directory in IIS. This way both applications can access the files from a central location.


I've been through these things a lot of times.

There are several considerations around the site / backoffice relations.

But to get to the bottom line of your question: Put your media files inside a totally separate directory, then save its location in each app's (WebForms + MVC) Web.config file, and access it by reading the appropriate configuration key. For example:

C:\Webs\MyFrontEndMvcSite
C:\Webs\MyBackOffice
C:\Webs\Content

It will also help you in deploying, for example you can put all media files in a separate static domain with will highly improve your site's performance. Your domain could be called static.mysite.com.

It will also help you keep your site (and backoffice) clean from "user generated content", so every time you deploy, you can freely override the whole app and not afraid that you accidentally delete custom user content (the only thing you'll need to worry of is not overriding web.config in the production server).

0

精彩评论

暂无评论...
验证码 换一张
取 消