Embedded Views

17 views
Skip to first unread message

bertvan

unread,
Aug 18, 2010, 3:32:07 AM8/18/10
to MVC Turbine
Hi,

I'm trying to get my app working with embedded views, but it does not
find my views.
What do I have so far (following the example)
- The views are in a separated project.
- The views are set to 'embedded resource'.
- My main project (the web project) references the view project and
references MvcTurbine.EmbeddedViews.dll
- I have my Global.asax inheriting TurbineApplication with exact same
constructor as in the sample.

However, I'm still getting the "The view X was not found" message:

The view 'LogIn' or its master was not found. The following locations
were searched:
~/Views/Account/LogIn.aspx
~/Views/Account/LogIn.ascx
~/Views/Shared/LogIn.aspx
~/Views/Shared/LogIn.ascx

The view is located in the 'base' assemby in Views\Account\Login.aspx.

What am I missing here?

Darren Cauthon

unread,
Aug 18, 2010, 9:08:28 AM8/18/10
to MVC Turbine

I use Embedded Views practically everywhere. Most of my MVC
applications are composed of many small MVC applications, which all
get sucked together at runtime. I'm saying this only because I just
want to let you know that embedded views *do* work, we just have to
figure out what's going on here. :)

The steps you listed are what I go through, but with one difference.
I don't know if this difference is the cause of your problem, but I'd
suggest you do it this way to get around some other issues that you
might encounter when you use embedded views. Here are my steps:

1.) Create my main MVC application.

2.) Turn it in to a Turbine application by adding references to
MvcTurbine.dll, MvcTurbine.Web.dll, MvcTurbine.EmbeddedViews.dll, and
the dlls for any IoC container you choose.

3.) Add an empty MVC application to the solution. Note: This is not
a class library, but an empty MVC application.

3.) Add a reference to the new project from your main MVC
application.

4.) Delete /Scripts, /Content, and the global.asax, but keep the /
Views folder and the Web.config in the root and in the Views folder.

5.) Create another controller with an index action.

6.) Create an index view in Views/[YOUR CONTROLLER NAME]/Index.aspx.
Make it an embedded resource.

Now start up the application and try to go to the view for the
controller. It should just come up.

If that doesn't work for you, I'll make a sample project with these
steps and email it to you. I'm not sure why it wouldn't just work for
you.

As a side note, I've been working on an Embedded Views screencast. I
wrote the notes last weekend, but I haven't recorded it yet because
I've been fighting a cold/virus/flu. If you can wait another day or
two, I can show you more.

Hope that helps!


Darren

bertvan

unread,
Aug 19, 2010, 6:35:51 AM8/19/10
to MVC Turbine
Thanks for the help. I got this working, however only locally and
under IIS 7, but not under IIS 6...

Is there anything special I'd need to do to get Embedded Views working
under IIS 6?

Darren Cauthon

unread,
Aug 19, 2010, 10:15:33 AM8/19/10
to MVC Turbine

I wish I could help, but none of my Turbine sites are running under
IIS6. :(


Darren
Reply all
Reply to author
Forward
0 new messages