Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

DotVVM + ASP.NET MVC in one application

This repo shows how to use DotVVM together with ASP.NET MVC application in the same application.

Prerequisites

How to run the sample

  1. Open the GitHub repo in Visual Studio or git clone https://github.com/riganti/dotvvm-samples-combo-with-mvc.git

  2. Open AspNetCore/DotvvmMvcIntegration/DotvvmMvcIntegration.sln (ASP.NET Core) or Owin/DotvvmMvcIntegration/DotvvmMvcIntegration.sln (.NET Framework with OWIN)

  3. Right-click the DotvvmMvcIntegration project and select View > View in Browser

What you can learn in the sample

  • How to use DotVVM together with other frameworks like ASP.NET MVC in the same app

Steps Required to Add DotVVM in Existing ASP.NET MVC App

OWIN (.NET Framework)

  1. Install the DotVVM.Owin NuGet package.

  2. Install the Microsoft.Owin.Host.SystemWeb package if you already don't have it in your project.

  3. Add the OWIN Startup class and call app.UseDotVVM....

  4. Unload the project, edit the .csproj file and add the DotVVM Project guid (94EE71E2-EE2A-480B-8704-AF46D2E58D94) as a first one in the <ProjectTypeGuids> element.

This is only needed to get full editing experience in Visual Studio. If you don't have the DotVVM for Visual Studio installed, do not add this GUID otherwise you won't be able to load the project.

It should look like this:

```
<ProjectTypeGuids>{94EE71E2-EE2A-480B-8704-AF46D2E58D94};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
```
  1. Make sure you have told the IIS to run all managed modules for all HTTP requests in the web.config:

      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <validation validateIntegratedModeConfiguration="false" />
      </system.webServer>
    
  2. Create your DotvvmStartup file and register your DotVVM routes. Any request that doesn't match any DotVVM route, will be passed to the ASP.NET MVC handlers.

ASP.NET Core

  1. Install the DotVVM.AspNetCore NuGet package.

  2. Register the DotVVM services in the ConfigureServices method in the Startup.cs file:

public void ConfigureServices(IServiceCollection services)
{
	...
	
	services.AddDotVVM<DotvvmStartup>();
	
	...
}
  1. Install the DotVVM middleware in the HTTP request pipeline in the Configure method in the Startup.cs file:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
	...

	app.UseDotVVM<DotvvmStartup>(env.ContentRootPath);
	
	...
}
  1. Create your DotvvmStartup file and register your DotVVM routes. Any request that doesn't match any DotVVM route, will be passed to the next middleware.

To separate DotVVM views from the MVC views, we have placed DotVVM views in a folder called DotVVM. However, it is not necessary. DotVVM doesn't care about where you have your views, so you can have views from both DotVVM and MVC in one folder.


Other resources

About

No description or website provided.

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.