Pregunta

I have developed a high-trust provider hosted app using the MVC framework to display a series of employee-focused KPI data widgets. Everything has been highly successful until I began implemented the App Parts (formally web parts -- iFrame views of the remote web application, for the uninitiated). The problem is specifically related to the routing, as I am able to successful view the application via the default route of each controller (using MVC attribute routing).

Results:

  • Any action result specified in [Route("action=TheView")] is a success.
    • Elements.xml example:
      • Src="https://apps.domain.com/Dashboard/TheView/?{Standard Tokens}" is a success
      • Src="https://apps.domain.com/Dashboard/TheOtherView/?{Standard Tokens}" is a 404 The Resource can not be found
      • Both URLs are accessible via web browser. Even explicitly revisiting the URL found in the web traffic logs (w/ parameters) is successful outside the context of SharePoint.

I certainly hope there is just some glaring, fundamental misunderstanding about using attribute routing in this scenario that I am not considering. However, I have received no useful error messages and none of my troubleshooting efforts have been successful.

Any help would be much appreciated.

¿Fue útil?

Solución

You mentioned you are using attribute routing.

Are you by any chance using [HttpGet] attribute on your ActionResult?

SharePoint addin does a POST to your web application. So just remove [HttpGet] attribute and let MVC handle it or change it to [HttpPost] if it doesn't work.

Licenciado bajo: CC-BY-SA con atribución
scroll top