Base solution for your next web application

Activities of "cicciottino"

Thanks a lot, it works!

Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependecy

i've just done:

  1. Downloaded the template (07/08/2016, i suppose 0.10.3.0 abp version)
  2. Update-Package (success)
  3. Update-Database (success)
  4. Play (debug)
  5. Got the error

I've tried to unistall and reinstall the package "Newtownsoft.json 9.0.1" but it did not resolve the problem. Could you help me to resolve or investigate on this problem?

These are the details from the error page (sorry, the language is italian):

[Assembly load trace]

=== Informazioni sullo stato di preassociazione ===
REG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
 (Fully-specified)
REG: Appbase = file:///C:/Users/a.pinato/Desktop/tempate aspnet application/MaiPuiSprechi/MaiPuiSprechi.Web/
REG: PrivatePath iniziale = C:\Users\a.pinato\Desktop\tempate aspnet application\MaiPuiSprechi\MaiPuiSprechi.Web\bin
Assembly chiamante: Microsoft.AspNet.SignalR.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
REG: l'associazione ha origine nel contesto di caricamento di default.
REG: utilizzo del file di configurazione dell'applicazione: C:\Users\a.pinato\Desktop\tempate aspnet application\MaiPuiSprechi\MaiPuiSprechi.Web\web.config
REG: utilizzo del file di configurazione host: C:\Users\a.pinato\Documents\IISExpress\config\aspnet.config
REG: utilizzo del file di configurazione computer da C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
REG: trovato reindirizzamento nel file di configurazione dell'applicazione: 6.0.0.0 reindirizzato a 9.0.0.0.
REG: riferimento post-criteri: Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
REG: tentativo di download del nuovo URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/23b8e119/1bfe6ada/Newtonsoft.Json.DLL.
REG: tentativo di download del nuovo URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/23b8e119/1bfe6ada/Newtonsoft.Json/Newtonsoft.Json.DLL.
REG: tentativo di download del nuovo URL file:///C:/Users/a.pinato/Desktop/tempate aspnet application/MaiPuiSprechi/MaiPuiSprechi.Web/bin/Newtonsoft.Json.DLL.
REG: tentativo di download del nuovo URL file:///C:/Users/a.pinato/Desktop/tempate aspnet application/MaiPuiSprechi/MaiPuiSprechi.Web/bin/Newtonsoft.Json/Newtonsoft.Json.DLL.
REG: tentativo di download del nuovo URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/23b8e119/1bfe6ada/Newtonsoft.Json.EXE.
REG: tentativo di download del nuovo URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/23b8e119/1bfe6ada/Newtonsoft.Json/Newtonsoft.Json.EXE.
REG: tentativo di download del nuovo URL file:///C:/Users/a.pinato/Desktop/tempate aspnet application/MaiPuiSprechi/MaiPuiSprechi.Web/bin/Newtonsoft.Json.EXE.
REG: tentativo di download del nuovo URL file:///C:/Users/a.pinato/Desktop/tempate aspnet application/MaiPuiSprechi/MaiPuiSprechi.Web/bin/Newtonsoft.Json/Newtonsoft.Json.EXE.

[Stack trace]

[FileNotFoundException: Impossibile caricare il file o l'assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' o una delle relative dipendenze. Impossibile trovare il file specificato.]

[FileNotFoundException: Impossibile caricare il file o l'assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' o una delle relative dipendenze. Impossibile trovare il file specificato.]
   Microsoft.AspNet.SignalR.DefaultDependencyResolver.RegisterDefaultServices() +0
   Microsoft.AspNet.SignalR.DefaultDependencyResolver..ctor() +84
   Abp.Web.SignalR.AbpWebSignalRModule.PreInitialize() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.SignalR\Web\SignalR\AbpWebSignalRModule.cs:18
   Abp.Modules.<>c.<StartModules>b__16_0(AbpModuleInfo module) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:47
   System.Collections.Generic.List`1.ForEach(Action`1 action) +11439282
   Abp.Modules.AbpModuleManager.StartModules() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:47
   Abp.AbpBootstrapper.Initialize() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:138
   Abp.Web.AbpWebApplication`1.Application_Start(Object sender, EventArgs e) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web\Web\AbpWebApplication.cs:36
   MaiPuiSprechi.Web.MvcApplication.Application_Start(Object sender, EventArgs e) in C:\Users\a.pinato\Desktop\tempate aspnet application\MaiPuiSprechi\MaiPuiSprechi.Web\Global.asax.cs:12

[HttpException (0x80004005): Impossibile caricare il file o l'assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' o una delle relative dipendenze. Impossibile trovare il file specificato.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9964625
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Impossibile caricare il file o l'assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' o una delle relative dipendenze. Impossibile trovare il file specificato.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

Some questions for you:

  • is it something related to SignalR? Do i need to install something on my machine?
  • in the stack trace i see some your local paths: D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.SignalR\Web\SignalR\AbpWebSignalRModule.cs (could it be a problem?)
  • it reports 2 different version of Newtonsoft.Json: Version=6.0.0.0 and Version=9.0.0.0 (why???)

i followed al the steps in the documentation: [http://aspnetboilerplate.com/Pages/Documents/Zero/Installation#DocInstallManual]) All goes well till i protect the controller adding [AbpMvcAuthorize]

this is the error than i got

[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_Views_Account_Login_cshtml.Execute() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\testfromscratch.web\93ffc943\d6ddc78a\App_Web_5dxdgfue.0.cs:0
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +142
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +109
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +379
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +108
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +97
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

<cite>ddNils: </cite> Have you considered using

   private readonly UserManager _userManager;

in your Controller (use DI to get the actual Manager)?

in my ApplicationLayer you mean? right?

this is what i need thanks!

just a doubt: anyway this method re-query the db each time is it right?! nothing to do with cache or session

oh thanks a lot i did it quickly and easily

  1. Added the navigation properties
  2. Add-Migration
  3. Update-Database

and it's done, nice.

the AbpZeroSampleAppServiceBase.cs is an abstract class, so it can't be injected but must be only inherited, is it true? in this case the option 2) in not possible Correct me if i'm wrong, please. what about the others options?

im my application layer, using "AbpSession.UserId" i can recover the id of the user, but what if i want to recover the username or other properties related to the user?

Should i query the db each time to gather these information?

I've seen that in the "AbpZeroSampleAppServiceBase"(downloaded from the template) there is a method named "GetCurrentUserAsync", could i use this? if yes, what is the better way to do it?

  1. make my application layer inherited from "AbpZeroSampleAppServiceBase" insted of "ApplicationService"
  2. inject this application layer inside my application layer
  3. avoiding to requery each time the db and extend the AbpSession in order to contain also the information i need (if yes, is there an extension point where i can load this information the first time and thant use wherever: AbpSession.UserName, AbpSession.MyCustomProperty)

I'd like to set up a tagging system for an entity in order to get a many to many relationship How is it possible achieve this sort relationship in abp?

Using a tag entity, an article entity and between them...? should i create another entity like "artcicles_tags"? Must this middle entity be derived from "Entity<long>" as well? and the mapping configuration is by convention or i must mapping it manually? Could you give me some clues? some suggestion?

no particular reason, just a quick way to have a javascript object similar and (and already with "camelCase" notation) to the server one. Only a way to be less typing error prone

forgive me for my english

good!, i accomplished this configuring the state provider as follow (inside app.js)

.state('poieditor', {
                    url: '/poieditor/:id',  //<--id parameter
                    templateUrl: '/App/Main/views/poi/editor.cshtml',
                    menu: 'PoiEditor'

and injecting into the controller the relative "$stateParams" service in order to recover the parameter

var _id = $stateParams.id;

i fond out that the UI Angular router offers a great flexibility this is a nice article (can be useful to someone) [http://www.ng-newsletter.com/posts/angular-ui-router.html])

thanks

Showing 11 to 20 of 42 entries