ASP.NET MVC: How to create a usable UrlHelper instance?

前端 未结 4 701
Happy的楠姐
Happy的楠姐 2021-02-13 05:26

I am using quartz.net to schedule regular events within asp.net mvc application.

The scheduled job should call a service layer script that requires a UrlHelper instance

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-13 05:57

    Edit: Sorry I totally mis-read the question I guess.

    It sounds like your scheduler (which I have no idea how it works) is a seperate process and you want the UrlHelper to help generate valid URLs in your MVC app?

    You could try writing a handler in your MVC app that will be running under your applications context that will build the URL for you and return it. You could then call the handler from your scheduler to get any URL you need based on the params you pass in. This way your scheduler just needs to know about where the query URL of your MVC app is and then can ask it to do the Url mapping for you.

    Hope this is a bit better of an answer. If I am totally off let me know... was going to delete my response but thought I would give it one more shot.

提交回复
热议问题