I have a single VS2010 solution with a Web.Api project and an MVC 3 project.
Both the Web.APi and the MVC project have their own App_Start with NinjectWebCommon in and their own bindings declared in there.
When trying to use the Api I always get the following message:
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
Line 30: DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
Line 31: DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
Line 32: bootstrapper.Initialize(CreateKernel);
Line 33: }
Line 34:
Source File: D:\Code\GreenDeal\PoS\GreenDeal.UI\App_Start\NinjectWebCommon.cs Line: 32
Stack Trace:
[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.Single(IEnumerable1 source) +371
Ninject.Web.Mvc.NinjectMvcHttpApplicationPlugin.Start() in c:\Projects\Ninject\ninject.web.mvc\mvc3\src\Ninject.Web.Mvc\NinjectMvcHttpApplicationPlugin.cs:53
Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map(IEnumerable1 series, Action1 action) in c:\Projects\Ninject\ninject\src\Ninject\Infrastructure\Language\ExtensionsForIEnumerableOfT.cs:32
Ninject.Web.Common.Bootstrapper.Initialize(Func1 createKernelCallback) in c:\Projects\Ninject\Ninject.Web.Common\src\Ninject.Web.Common\Bootstrapper.cs:53
XXXX.UI.App_Start.NinjectWebCommon.Start() in D:\Code\XXXX\PoS\XXXX.UI\App_Start\NinjectWebCommon.cs:32
I do not get this error if I remove the WebActivator.PreApplicationStartMethod from the Api or the MVC site.
I presume there is an issue with having the two Starts but am not sure what to do? Can I make them co-exist? Should I split into 2 solutions and hope it goes away? When deployed the site and the api will reside on separate servers and the site will consume the api.
Went back to basics.
Followed the steps defined in here: http://www.eyecatch.no/blog/2012/06/using-ninject-with-webapi-rc/
Still had issues but that was because the MVC, client site had a reference to ninject.webapi. Removed that and all works.
Related
I am getting an error with my asp.net core 2.1 MVC project template. It looks like _Layoutlogin .cshtml is not able find. File is there in the shared folder and the only thing is that in the error message before .chmtl there is space at the end. This is happening after scaffolding idenitity
An unhandled exception occurred while processing the request.
InvalidOperationException: The layout view '~/Views/Shared/_Layoutlogin .cshtml' could not be located. The following locations were searched:
~/Views/Shared/_Layoutlogin .cshtml
Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executingFilePath, string layoutPath)
I suspect you have a typo some place if you check _Layoutlogin .cshtml there is a space in their so if in fact your file is _Layoutlogin.cshtml its not going to find it.
My project is a simple login page. I am using asp.net core with MVC.
Everything was working well and I wanted to add service worker to my project. I followed the known steps. Add a manifest.json file in wwwroot, fill it correctly and add this function services.AddProgressiveWebApp(); after services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);.
When others do these steps, service worker works properly. When I run it (IIS Express), service worker produces an error: "Uncaught (in promise) TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script."
Then I realized this thing: https://localhost:44331/~/serviceworker.
The ~ symbol is created automatically and I am not knowing how to remove it.
The following https://localhost:44331/serviceworker works.
Help?
It is solved.
I updated the version from v1.0.42 to v.1.0.33 and it worked.
v1.0.42 has a bug.
I am trying to enable the ZoomMode of a Shield ASP.NET MVC chart but I am receiving the following error:
Server Error in '/' Application.
________________________________________
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'Shield.Mvc.UI.Chart.ChartBuilder<object>.ZoomMode(Shield.Mvc.UI.Chart.ZoomMode)' has some invalid arguments
According to documentation (https://www.shieldui.com/documentation/javascript.chart/api/zoomMode) there are 3 zoom modes:
Possible values are: 'x', 'y' and 'xy'.
Why do I receive that error since I declare it as in the documentation:
#(Html.ShieldChart()
.Name("chart")
.ZoomMode("XY")
.Export(false)
?
The mistake you are making is that you are using a string and not the predefined type that needs to be used when working with MVC. It is true, that for the JavaScript Shield UI chart the zoom mode is defined by passing a string parameter, but in MVC you need to use following code:
.ZoomMode(Shield.Mvc.UI.Chart.ZoomMode.XY)
Hello I am Developing a ASP.NET MVC3 application and MYSQL Database accessed by entity framework. I am done with the deployment part and now i am trying to deploy it on GO DADDY server after deploying it so far every page is working fine but only in one page the following error is coming
Specified method is not supported.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Specified method is not supported.
i have tried a lot searching to find the solution of the error please help me with this
following is the snap shot of the error
You happen to have a query that results in the DbApplyExpression node in the command tree. This node is typically translated to CROSS/OUTER APPLY construct in SQL however MySQL does not support CROSS/OUTER APPLY. Most likely you will have to change your query a little bit to avoid the CROSS/OUTER APPLY. Take a look a this msdn article for more details. I also found something at DevArt website that can be helpful
I'm trying to follow a couple of tutorials on using the standard ASP.NET membership in MVC 3, as soon as I create an MVC 3 web application (Internet Application) in Visual Studio 2010 and I run the sample solution and click 'Log In' on the generated template I get an error:
Compiler Error Message: CS0426: The type name 'Models' does not exist in the type 'System.Web.Security.Membership'
Line 28:
Line 29: public class _Page_Views_Account_LogOn_cshtml : System.Web.Mvc.WebViewPage<Membership.Models.LogOnModel> {
I searched around but I can't seem to find any solutions. It's obviously something trivial, any ideas?
Thanks.
What is your project name? is it Membership?
Error occurred because confuse between System.Web.Security.Membership and Membership (Project namespace )
Change project name