Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NitroNetsitecore not working as expected, need a dummy solution #19

Closed
ssatpa opened this issue Aug 31, 2017 · 6 comments
Closed

NitroNetsitecore not working as expected, need a dummy solution #19

ssatpa opened this issue Aug 31, 2017 · 6 comments
Labels

Comments

@ssatpa
Copy link

ssatpa commented Aug 31, 2017

Hello,

I have followed the steps for NitroNet sitecore Setup.

The issue that I'm facing is that it is not working for Html file for the main layout and I'm getting an Internal Server Error message.

When for testing purpose I have added a cshtml file the error got removed but in case of cshtml file it is considering the handlebars as normal text.

It would be great If we can get a sample solution for NitroNetSitecore

@daniiiol
Copy link
Contributor

daniiiol commented Sep 1, 2017

Hi ssatpa

So sorry for the inconvenience with the setup of NitroNet Sitecore.

Internal Server Message
Could you give us more informations about your "Internal Server Error"? Perhaps we will be able to help you :) Useful issue reports are ones that get issues fixed. And all detailed issue reports help us to make NitroNet more robust.

Demo Solution
Yes, we will provide a sample solution for NitroNetSitecore as soon as possible. See also issue #11
to track the state of this request.

@ssatpa
Copy link
Author

ssatpa commented Sep 1, 2017

Hello @daniiiol ,

Please find the steps which currently I'm trying for your reference -

  1. I have created .NET application using 4.6 framework and installed Unity.MVc and Nitronet.sitecore.UnityModules from nuget. Created a new sitecore instance with sitecore 8.2 update 3.
  2. Registered the view engine in global.asax "ViewEngines.Engines.Add(DependencyResolver.Current.GetService());" and activated NitroNet for Sitecore with Unity in Unit.config.
  3. activate "nitronet-config.json" without changing the NitroNet.BasePath which is in my case frontend.
  4. Created a component, controller and a model using the same name i.e. "ImageText".
    ImageTextController .cs
    public class ImageTextController : Controller { // GET: ImageText public ActionResult Index() { var model = new ImageTextModel { Text = "Some dummy Text", Title = "Some dummy Title" }; return View("imagetext", model); } }

ImageTextModel.cs
public class ImageTextModel { public string Title { get; set; } public string Text { get; set; } }

MainLayout.html

<title></title> {{component name="ImageText"}} {{placeholder name ="MainContent"}}

ImageText.html -
"


{{{Title}}}

{{{Text}}}

" ImageText.json - { "Text": "Some Text", "Title": "Some Title" } PFA the screenshot for the folder structure - ![image](https://user-images.githubusercontent.com/23360308/29977468-1330aa20-8f5b-11e7-86a2-4457871f0e6b.png)
  1. In sitecore created a Layout as MainLayout with Path as - /frontend/views/MainLayout and set the layout in a item.
  2. Now when I open the page in exp editor I get an issue as "HTTP Error 500.0 - Internal Server Error" PFA the screenshot -
    image

When i change the extension of layout as /frontend/views/MainLayout.cshtml and in the solution folder also i change the extension from .html to .cshtml, I get a result as -
image

Please let me know if any other information is required.

@ssatpa
Copy link
Author

ssatpa commented Sep 4, 2017

scsupport_NitroNetPOC_201709041020.zip

Hello @daniiiol
PFA the support package of the application that I have created.

@ssatpa
Copy link
Author

ssatpa commented Sep 4, 2017

NitroNetSitecorePOC-Code.zip

Hello @daniiiol
PFA the code

@NaibafCH
Copy link
Contributor

NaibafCH commented Sep 4, 2017

Hi ssatpa

I'm currently working on a small demo solution for NitroNetSitecore and had the exact same error. The cause of this problem was the leading slash of the value which is saved in the "path" field of the layout item. For your solution this means you need to enter the value "frontend/views/MainLayout" there. Also make sure you respect case sensitivity. I hope this fixes the problem, please let me know.

There is another learning I had during my work. If you are using Microsoft.DependencyInjection then the registration of the view engine in global.asax is too early. You need to do it at the end of the initialize-pipeline in Sitecore. This registration will be done automatically in a future release: #20

We are going to update the documentation and make sure these details get a better description.

@ssatpa
Copy link
Author

ssatpa commented Sep 5, 2017

@NaibafCH .. thanks for your help, It is working fine now

@NaibafCH NaibafCH closed this as completed Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants