I'm working on my first ASP.NET 5 application. When trying to start the application from the command line by running:
dnx web --watch
I get the following output:
System.FormatException: Value for switch '--watch' is missing.
at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProvider provider)
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at Microsoft.AspNet.Server.Kestrel.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
What are the valid values for the --watch flag? I tried giving it a dummy value of 0 then changed some of my controller code, but the change was not reflected.
Update
To install dnx-watch run the following:
dnu commands install Microsoft.Dnx.Watcher
Then run your application by doing something like:
dnx-watch web
Arguments passed after the command name ("web" in your case) are arguments passed to that command. If you want arguments passed to DNX, pass them before: dnx --watch web
But, --watch will go away. Use dnx-watch instead: https://github.com/aspnet/Announcements/issues/74
Related
I'm getting a null reference for an asp.net application while running precompile using aspnet_compiler. There's no specific error however i have this in the build log.
[NullReferenceException]: Object reference not set to an instance of an object.
at System.Web.Compilation.BuildManager.CopyPrecompiledFile(VirtualFile vfile, String destPhysicalPath)
at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirectory sourceVdir, String destPhysicalDir, Boolean topLevel)
at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirectory sourceVdir, String destPhysicalDir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
Things i've tried so far,
Clearing temp
Assigning permissions to folders
Checked for folder compression
Checked for *.compiled files in bin
Deleted *.ddl refresh dlls in bin
I'm running build from command line with the following,
c:\windows\Microsoft.NET\Framework\v3.5\MSBuild.exe Build.xml /target:Precompile > log\Precompile.txt
This is the target definition in the build xml
<Target Name="Precompile">
<Exec
Command=""C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler" -v Web -p E:\Src\Web -u -f -d -fixednames E:\Output -errorstack"
WorkingDirectory="."
ContinueOnError="false"/>
</Target>
So far nothing has helped, i've taken this up from a colleague who says it was working fine the other day, how do i go about troubleshooting this? Build is running and the exit happens only towards the end, another thing is its running ok from visual studio, only the command line build is breaking, any pointers ? thanks
Full error:
System.MissingMethodException: Method not found:
'Microsoft.Extensions.PlatformAbstractions.ILibraryManager
Microsoft.Extensions.PlatformAbstractions.PlatformServices.get_LibraryManager()'.
at Microsoft.Data.Entity.Commands.Program.ValidateProject(String
targetProject) at
Microsoft.Data.Entity.Commands.Program.<>c__DisplayClass2_7.b__15()
at
Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[]
args) at Microsoft.Data.Entity.Commands.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly
assembly, String[] args, IServiceProvider serviceProvider) at
Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.b__0()
at System.Threading.Tasks.Task`1.InnerInvoke() at
System.Threading.Tasks.Task.Execute()
Command that I try to run:
dnx ef migrations add test1
Version of EF commands:
Entity Framework Commands 7.0.0-rc1-16348
Version of dnx:
Microsoft .NET Execution environment Clr-x86-1.0.0-rc2-16595
My project currently use RC1. It all worked before.
Mostly sure the issue is the fact that you're mixing RC1 packages with RC2 runtime. Downgrade the runtime to RC1 or switch from dnx to dotnet and upgrade the packages to RC2
I am on Ubuntu 14.04
I have installed ASP using these instructions http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
Running dnvm list gives me the following:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-update1 coreclr x64 linux default
1.0.0-rc1-update1 mono linux/osx
I then tried to create an ASP application using this tutorial:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
However when I run dnx run I get the following error:
System.InvalidOperationException: IHostingBuilder.UseServer() is required for Start()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureServer()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.Start()
at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args)
at ASPTutorial.Startup.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
A similar issue arises when I change from coreclr to mono.
UPDATE
dnx web works fine however!
The command to run with dnx is defined in the project.json in your project.
As mentioned in the comments, "run" is usually used for console applications and "web" is used for web applications. But you can write any command name you want in your project.jseon, even something like:
"commands": {
"runmyawesomeapp": "[...]"
}
And you can run it with
> dnx runmyawesomeapp
hope this helps :)
I've been using MbUnit for unit testing for a while, along with Nhibernate and Sqlite.
I am now trying to setup a CI server with Jenkins - I have successfully managed to configure Jenkins to pull the code from github and compile it using MSBuild everytime anyone pushes to github. Finally I want to run tests on the code on each successful build.
The tests all run successfully when run from within Visual Studio without any problem whatsoever, I can run each test individually or the whole project and they all run OK. However when I call Gallio.Echo.exe from command line all the tests that have to do with Sqlite fails.
This is what I've been doing to run the test from command line:
"C:\Program Files\Gallio\bin\Gallio.Echo.exe" /report-type:Html /verbosity:quiet "D:\MyProject\MyProject.Tests\bin\Debug\*.Tests.dll"
(ps: There seems to be absolutely no documentation about gallio tools - have I been looking in all the wrong palces? I want to find more about the command line arguments that I can pass)
The tests fail with this:
Gallio Echo - Version 3.3 build 454
Get the latest version at http://www.gallio.org/
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[failed] Fixture MyProject.Tests/VerificationTests
Set Up
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
HResult: -2147024809
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor()
--- End of inner exception stack trace ---
I've tried a few solutions mentioned around on SO but haven't been able to solve it. The only close thing was this answer but I am not sure what the user means by adding to config files.
Anyone has any idea why the tests fail from command line but are okay when run from within VS please?
Thanks.
If I run this command on my system
<Exec Command="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler -v localhost -p $(SourceDir)\wwwroot -u -f projectCompileCode\project -c -errorstack -nologo" />
I get the following error:
error ASPParse: Could not load the type: Projectname:SomeFile.
The project is web application project
This my stack trace:
[HttpException]: Could not load type 'ProjectName.FileName'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCa
e, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeN
me, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDicti
nary parseData)
[HttpParseException]: Could not load type ''ProjectName.FileName.
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virt
alPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualP
th virtualPath)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPat
virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType(
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(
uildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResu
t(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath
tartingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath starting
irtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCa
lback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
If I build in v2.0.50727 then still it is giving the same error.
My application is built in with VS 2010, .net frame asp.net frame work 4
Any help is greatly apperciated.
Have you tried:
Checking references
Doing a clean and a build
Checking the Inherits attr in the HTML against the code behind
Creating a new App Pool in IIS for this web site?
I see a similar problem. Works locally from within VS2008, but once published and deployed to the server, I get the same error as described here.
None of the suggestions I have provided worked for me; maybe they will work for you.
I had the same error. When I opened the web site DLL in ILDASM, the Type for a control was completely missing, as if it didn't even get compiled.
As it turns out, the codebehind files got excluded from the project. This is strange considering that the builds on my machine were successful! At any rate, I carefully re-included codebehind files and it all started working.
This often happens because the project file (.csproj or .vbproj) does not contain the necessary references to the files in question. Try cleaning/rebuilding all projects and making sure that the latest project files are moved to the server as well.
Another possibility is that the file was not actually included in your project at all. This allows the builds in Visual Studio to run just fine, but will break when compiling the .NET code (with aspnet_compiler for example) because all .aspx/.ascx/etc. files within the specified folder are compiled - whether they are included in your project or not.