download source code, but not working - asp.net-mvc

I had a problem with part 3 of an orchard tutorial...
so I was attempting to download the source code for part 4 and continue on from there (which can be found about 3/4 of the way down at the end of the tutorial on the page http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-4
However when I run part 4 from webmatrix I get the error(see below)
im guessing this is because iv only downloaded the code but i need to put it inside a seperate project? is this correct? can someone advise me how to do this?
thanks for any replies

The error states that there is no default document configured in IIS. Attempt to access the document using the full URL.
For instance http://localhost:28266/default.aspx (or similar)
You can then adjust IIS to have the correct default document (if desired)
Edit: After reviewing the referenced ZIP archive.
This looks like a changed file zip for the application. This isn't a complete ASP.NET MVC application by itself and, as such, isn't viewable stand alone. I don't have the time to parse the exact steps required to make this application work alongside the demos provided, but be sure you're either combining all of the previous files and folders in order or follow the instructions detailed by the author.
As referenced, this is not a complete ASP.NET MVC application and isn't ready to be immediately rendered by IIS.

The problem is probably that the application can't start for some reason, which causes IIS to attempt to respond to the request with other handlers. Because there is no default document defined (and there shouldn't), it tries to do a directory listing, which is not allowed in your configuration. Do not focus on what IIS is telling you but rather on why your application doesn't run.
Things to check:
you have built the application
you are running in full trust
you are running in integrated mode
there is no exception in app_data/logs
you added the module to a working Orchard instance, in its Modules directory

Related

Web API Help Pages not loading documentation XML

I'm trying to set up the ASP.NET Help Pages to run in an existing MVC project, though pointing towards the documentation file from a Web API project in the same solution. Convention has the Help Pages running inside the Web API that it's documenting but in this case I want it in a sibling MVC project.
The Web API project outputs its documentation XML file in a folder within the MVC project.
I've installed the Microsoft.AspNet.WebApi.HelpPage NuGet package in the MVC project. This creates a class \Areas\HelpPage\App_Start\HelpPageConfig.cs, and within this class's Register method I've passed the XmlDocumentationProvider the path to the Web API's documentation file.
But when I load the page, it's empty, aside from a title and a placeholder description.
Upon debugging the HelpController.Index method, I can see in the returned IApiExplorer that the _apiDescriptions are empty.
However, if I install the Help Pages directly into the Web API project and debug the same method, I can see that the _apiDescriptions are now present.
Can anyone explain what the Web API project is doing or has configured which the MVC project isn't doing or hasn't configured?
Just set this up myself, and I think I ran into a similar issue, if i'm reading what you're saying correctly.
Try the following:
Go to Areas\HelpPage\App_Start\HelpPageConfig.cs. Around line 36, you'll want to make sure you uncommented the line as below:
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/ApiDocumentation.xml")));
And make sure the path is correct. I happened to put my xml file in the App_Data directory.
Go to Project=>Properties=>Build. Under Output, make sure the "XML documentation file" box is checked, and point it to App_Data\ApiDocumentation.XML (assuming you put it in the same place i did above.
If i remember correctly, i had to make sure i added the .xml file to the project- i had some problems when i tried publishing it to our test server at work and it said the file couldn't be found. After you build, simply go to App_Data, right click on the folder, and add existing item. navigate to App_Data in your file system and select the xml file.
This will hopefully fix your problem!
I'm not sure if this will help anyone else that stumbles across this, I had started with a blank template from VS and added the help files via the Nuget package.
Because it was a blank template and I had no areas set up, it was missing the following from the global.asax
AreaRegistration.RegisterAllAreas();
This prevented the HelpPageConfig.Register from being called and thus, the Xml Documentation provider was never set.

mvc asp.net web project first load

I published My Web project that written by C# MVC5 ASP.NET and Entity framework on a Shared Host. First Time that it loads, speed is very slow and take a long time almost 12 second but after that it is ok . I tested my website on a gtmetrix.com and fortunately is in A class.Could anyone tell me why it takes a long time for first load ?I have some suggestion.
1)it because of entity framework ?
2)it because of a lot of library that I used them and it needs to load these dll files before load ?
3)I need some config in IIs (I dont access to IIs Server because Im using shared host)?
(also compilation debug is false)
I am appreciated If some one help me .
web site address is www.kajalmarket.com and is uploaded most recently .
You can precompile prior to deployment if you're concerned.
Here's more info:
https://msdn.microsoft.com/en-us/library/ms227972(v=vs.90).aspx
Precompiling an ASP.NET Web site provides faster initial response time for users since pages do not have to be compiled the first time they are requested. This is particularly useful for large Web sites that are updated frequently.
You can also select "Precompile during publishing" if you publish via Visual Studio:
Click here to see screenshot.
Another option is as follows taken from ( https://msdn.microsoft.com/en-us/library/ms366723.aspx ):
If you want to be able to change top-level files without causing the whole site to be recompiled, you can set the optimizeCompilations attribute of the compilation element in the Web.config file to true. If optimizeCompilations is true, when you change a top-level file only the affected files are recompiled. This saves time but can cause run-time errors depending on the type of changes you make to a top-level file.
With this method you should see a reduced re-compilation time as it only recompiles those top level files that have changed.
HTH

How to deploy Umbraco 5 website

I hope I'm asking this question in the right place. I also asked on umbraco forum, but did not get any response yet.
I'm having problem with deploying my Umbraco 5 website to external hosting.
On local machine, I used Umbraco 5 template for VS2010, which works fine (although it's quite slow).
When I publish to live server I get 500 error.
So far, i've tried installing fresh copy of umbraco on hosting (works fine).
I copied config files in hive provider folder (in App_Data), to point umbraco to my hosting database. That does not throw any exceptions yet. Problem starts when I copy views and partial views over - umbraco then finds the template defined in database and tries to load that.
It's worth mentioning that I also copied my project.dll file into bin directory on the server - the reason for that is because I have added new controller which inherits from surfacecontroller (in /Controllers folder).
Please let me know if I'm doing something wrong.
Cheers
Sebastian
It is not any different than deploying a MVC3 website.
There are quite a few questions with exactly that signature here on so.
Visual studio even has a few tools to help you in the process.
The publish function is found right clicking the project in the solution explorer.
If you use the template for developing, you have a working umbraco solution locally right?
If that is the case, it is easier to just deploy / publish the entire site intead of copying bits into another umbraco solution.
Publish tool
When using that tool, remember that umbraco has quite a few config files etc. and they all need to be included. So it is probably the easiest to just export all files in the folders, by changing "which files to include" setting in publish tool. That will unfortunately include all your .cs files too, but later they can be filtered out of the publish process.
First make it work, then make it awesome :)
The same goes for compilation mode, i have found that release mode sometimes breaks things, so for now just keep it in debug mode.
Then later when you have it working, you can change to release mode for a small performance gain.
Stuff to remember
include all necessary files
change connectionstrings
copy databases
custom errors, you don't want your visitors to see YSOD's with your internal debugging info.
disable tracing and debugging!
After reading this, you should go on and look for other more elaborative resources too.
"umbraco then finds the template defined in database and tries to load that" is key point to me
whatever the version you follow the templates and doc types are the backbones of umbraco ( from you website I know that you are aware with above more then me.. but repeating.) I mean you have created new website but there are no relative Templates and Doctype yet you try to use them in views and subviews and that caused the problem.
To do that please create tempalte and doctype same as is in you staging site and this problem will be solved.
Even better kick-start you development with new site only and make replica of that after defining doc-type and templates to your staging.
I hope i can explain my point.
Thanks,
Jigar
I've had problems in the past deploying Umbraco 5 projects. When you deploy an Umbraco 5 website to a new server and before you switch the website on in IIS, navigate to \App_Data\ClientDependency and delete any XML files that are there. Next, navigate to \App_Data\Umbraco\HiveConfig and delete the ConfigurationCache-*.bin files.
Once you've done that, recycle your Application Pool and start your website.

Silverlight Cannot find XML data source

I am very new to Silverlight development. I understand that this is client side technology therefore the paradyme is differant from that of conventional ASP.NET development. Having said that, I don't understand where my server side code is deployed.
I have a silver light \ MVC application. I am trying to read an XML document from within my 'Models' folder. The following peice of code is executed from within a class that is in the same location as the XML document, 'Models'. The load() results in a SystemIOFileNotFound exception. I noticed that when building the application the XML document is not laid down in the same location as the web project's assembly. I assume this is specific to the fact that this is a Silverlight project. Can someone tell me what I'm missing?
_xdoc = new XDocument();
_xdoc = XDocument.Load(new Uri("videos.xml",UriKind.Relative).ToString());
Edit..
The behavior I am after is the start page (silverlight) populates controls via a server side controller. ie localhost/video
Silverlight can't access your filesystem (thankfully), which is why you can't access the file. Try embedding it as a resource, or storing it in the local storage API provided by silverlight.
Assuming that your Models folder is in the Web project (i.e. not the Silverlight project), I think that your problem is unrelated to Silverlight.
The code loading the XML file assumes that the file is in the current directory, so you need to ensure this through your deployment technique.
If you are doing this in the Silverlight part, you should put the XML file in an embedded resource and access it as a stream (get it with Assembly.GetManifestResourceStream) or as a resource (a la WPF, not an embedded resource) and access it with the package part syntax.
The problem was that I was attempting to access this static resource as you would in typical ASP.net. However I found it necessary to map the path to the file using the current HTTPContext:
HttpContext.Current.Server.MapPath("~/App_Data/videos.xml");
So the above worked for me. Since this code is in the web project and not in the silverlight project I am still unclear as to why I cannot just access this resource using a relative path. This code will be executed in the context of the web server.
i.e.
XDocument.load(../App_Data/videos.xml);

Should cs files be deployed when publishing an ASP.Net MVC application?

I have a project that compiles and runs fine on my development machine but when I run it on the web server I get the following error.
Parser Error Message: The file '/Views/Shared/Main.master.cs' does not exist.
The file mentioned does not exist on the server but the file '/Views/Shared/Main.master' does.
I use the 'Publish' command to upload the project. Is it missing the cs files?
Is there some setting where it does just in-time compiling that need to turn off?
I stumbled upon this solution.
The master page has the following attribute CodeFile="Main.master.cs". When I replaced this with CodeBehind="Main.master.cs" it works as expected.
The file originally came from an older web application but I don't know what the difference means. If someone else can come up with a better explanation I will accept their answer instead of this one.
Glad you got it figured out. It may come from an issue when converting from "Web Site" to "Web Application" project type.
http://aspadvice.com/blogs/ssmith/archive/2007/01/24/CodeFile-or-CodeBehind.aspx
Usually the files are marked with a reference to a dll that exists in the bin, e.g. App_Web_nnnnn in the inherits declaration of Main.master. Is that the case for that file on the web server and does the referenced dll exist in the bin? If not then it may not be pre-compiling as it should.
As far as I have seen with MVC, I don't think you even need the code-behind pages, do you?
I have removed the references from any pages in my app that were there for any reason.
Also, when you create a new View, I don't think it even creates the code-behind page in MVC, does it? (Really threw me to start with!!)

Resources