Asp.NET 网站中的 Castle Monorail?
在我们的系统中,大部分代码都在 asp.net (2.0) 网站中,几个月前我发现了 Castle Monorail,我认为它确实比 asp.net / webforms 更容易使用。
这是我们需要的: - 使用城堡单轨列车 - 我们的代码必须在网站中(我的主管是一位老派的网络开发人员,所以他更喜欢一些“.cs”文件而不是一个“.dll”)。 - 我们必须保留现有的 webforms 代码
所以也许如果您有教程或类似的东西(我找到了很多关于 asp.net MVC 和 castle monorail 的教程,但我确实找到了有关 asp.net 2.0 的教程)/
谢谢同事
In our system most of the code is in an asp.net (2.0) web site, I discovered Castle Monorail a few month ago and I think it's really easier to use than asp.net / webforms.
Here is what we need :
- Use Castle Monorail
- Our code must be in the website (my chief is a kind of old school web developer so he prefer to have some ".cs" files than one ".dll").
- We have to keep the existing webforms code
So maybe if you have a tutorial or something like that (I found a lot of tutorial about asp.net MVC and castle monorail but I did find any with asp.net 2.0)/
Merci les collegues
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以这非常简单(顶部 15 分钟):
1/ 从 web.config 获取您需要的元素:
- 配置部分处理程序
- 配置本身
“App_Code”是网站程序集的名称。
-http handlers
-http module
2/ 在我的例子中获取您需要的dll(我不使用activerecord):
Castle.Components.Binder.dll
Castle.Components.Common.EmailSender.dll
Castle.Components.Common.TemplateEngine .dll
Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.dll
Castle.Components.Validator.dll
Castle.Core.dll
Castle.MonoRail.Framework.dll
Castle.MonoRail.Framework.Views.NVelocity.dll
Castle.MonoRail.ViewComponents.dll
3/ 在 App_Code 文件夹中添加一个类(例如 TestMonorailController):
使用 Castle.MonoRail.Framework;
4/ 在网站根目录中添加 Views 文件夹
5/ 在刚刚创建的文件夹中添加一个TestMonorail文件夹
6/ 在此文件夹中添加文件名“OnePage.vm”:
7/ 测试您的网站:
http ://localhost:XX/YourWebSite/TestMonorail/OnePage.rails
并且您应该看到
“TEST”
等瞧:)我可以编辑我的生产代码。谢谢肯
So it was pretty simple (15 min top) :
1/ Get the element that you need from web.config :
- config section handler
-Configuration itself
"App_Code" is the name of the web site assembly.
-http handlers
-http modules
2/ Take the dll that you need, in my case (I don't use activerecord) :
Castle.Components.Binder.dll
Castle.Components.Common.EmailSender.dll
Castle.Components.Common.TemplateEngine.dll
Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.dll
Castle.Components.Validator.dll
Castle.Core.dll
Castle.MonoRail.Framework.dll
Castle.MonoRail.Framework.Views.NVelocity.dll
Castle.MonoRail.ViewComponents.dll
3/ Add a class in your App_Code folder (for instance TestMonorailController) :
using Castle.MonoRail.Framework;
4/ Add a Views folder in the root of your website
5/ Add a TestMonorail folder in the folder you just created
6/ Add a file name "OnePage.vm" in this folder :
7/ Test your website :
http://localhost:XX/YourWebSite/TestMonorail/OnePage.rails
and you should see
"TEST"
Et voila :) I can edit my production code. Thx Ken
我想您可以将控制器类放入 App_Code 中并完成它。
您需要为单轨铁路网址映射一个特殊的扩展名。
如果您不使用 SOAP Web 服务 (.asmx),则将此扩展映射到 Monorail 的 HttpHandlerFactory。
一个有趣的罪魁祸首可能是包含 App_code 文件的实际程序集没有一个好的名称(我认为),并且 MonoRail 确实需要知道从中查找控制器类的程序集。
我建议您尝试一下我上面列出的提示,看看它会给您带来什么。分享您看到的异常情况,希望我们能尽快查清真相
I guess that you could put the controller classes in App_Code and be done with it.
you will need to map a special extension for Monorail urls.
If you do not use SOAP webservices (.asmx) then map this extension to Monorail's HttpHandlerFactory.
An interesting culprit could be that the actual assembly containing the App_code files does not have a nice name (I think), and MonoRail does need to know the assembly from which to locate controller classes.
I'd suggest you play with the hints I've listed above and see where it gets you. Share the exceptions you see and hopefully we'll get to the bottom of it soon