2

environment:

  • SharePoint 2016
  • Windows Server 2016
  • VS 2017
  • a Mvc4 app (.net 4.6)
  • a junior programmer
  • aim

    Let my MVC4 app be published to SharePoint like the SharePoint project,enabling it eo be built automatically when the management center migrates or creates a new server.

    try

    I found a solution on ths website:http://aspalliance.com/1944_using_aspnet_mvc_1_with_sharepoint_publishing.3

    I tried replacing SPHttpApplication to register my route ,but always get [System.ArgumentExpetion:virtualPath] error;

    Can MVC be integrated with SharePoint,what should I do?

    1 Answer 1

    0

    You need to make sure your actually calling RegisterRoutes(RouteTable.Routes); from the Application_Start method in your inherited SPHttpApplication class (as per the example solution). And you will need to ensure you have setup the MVC routes accordingly.

    Otherwise can I suggest having a look at the opens source sharepointmvc. Its quite old, but reviewing code and solution structure may be helpful as an end to end example and documentation.

    Overall I would reconsider the benefits of doing this. The complexity introduced to your SharePoint Farm (i.e Patching, Migration, Solution conflicts, Support) is very large and I feel would more than likely outweigh the benefits.

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.