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

Running k web from mapped network drive causes unhandled exception (klr.exe has stopped working) #24

Closed
clintkolodziej opened this issue May 14, 2014 · 4 comments

Comments

@clintkolodziej
Copy link

When running the 'k web' command from one of the samples (HelloWeb, HelloMvc) from a mapped network drive (w:) I get the following unhandled exception. Probably not a bad idea to just output an error message, or a security confirmation message asking the user if it is safe to run, rather than crashing out the klr.exe.

Output from the command:

W:\repositories\Home\samples\HelloMvc>k web

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---> System.Reflection.TargetInvocat
ionException: Exception has been thrown by the target of an invocation. ---> Sys
tem.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNet.Host
ing' or one of its dependencies. Operation is not supported. (Exception from HRE
SULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load
 an assembly from a network location which would have caused the assembly to be
sandboxed in previous versions of the .NET Framework. This release of the .NET F
ramework does not enable CAS policy by default, so this load may be dangerous. I
f this load is not intended to sandbox the assembly, please enable the loadFromR
emoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more
information.
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence
)
   at System.Reflection.Assembly.LoadFile(String path)
   at klr.hosting.LoaderEngine.LoadFile(String path)
   at klr.host.DefaultLoaderEngine.LoadFile(String path)
   at Microsoft.Framework.Runtime.Loader.NuGet.NuGetAssemblyLoader.Load(LoadCont
ext loadContext)
   at Microsoft.Framework.Runtime.Loader.AssemblyLoader.LoadImpl(LoadContext loa
dContext, Stopwatch sw)
   at Microsoft.Framework.Runtime.Loader.AssemblyLoader.Load(LoadContext loadCon
text)
   at Microsoft.Framework.Runtime.Loader.AssemblyLoader.LoadAssembly(LoadContext
 loadContext)
   at Microsoft.Framework.Runtime.DefaultHost.Load(String name)
   at klr.host.HostContainer.Load(String name)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass0.<Execute>b__8(AssemblyN
ame assemblyName)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass0.<Execute>b__11(Object s
ender, ResolveEventArgs a)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String a
ssemblyFullName)
   --- End of inner exception stack trace ---
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod
eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&
stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro
spection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String code
Base, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& s
tackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntros
pection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as
semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar
k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn
trospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint(String applicationNa
me)
   at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host,
String applicationName, String[] args)
   at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly ass
embly, String[] args, IServiceProvider serviceProvider)
   at klr.host.Bootstrapper.Main(String[] args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at klr.hosting.RuntimeBootstrapper.Execute(String[] args)
   at DomainManager.Main(Int32 argc, String[] argv)
@glennc
Copy link
Contributor

glennc commented May 20, 2014

Out of interest, can you run it when using -svrc50?

@clintkolodziej
Copy link
Author

Works fine with -svrc50, fails with -svr50:

W:\repositories\Home\samples\HelloMvc>k web

Loaded Module: klr.core45.dll
Found DLL Export: CallApplicationMain
Information: RootHost.Load name=Microsoft.Framework.ApplicationHost
Information: RootHost Assembly.LoadFile(C:\Users\Clint\.kre\packages\KRE-svrc50-
x86.0.1-alpha-build-0446\bin\Microsoft.Framework.ApplicationHost.dll)
Information: RootHost.Load name=Microsoft.Framework.Runtime
Information: RootHost Assembly.LoadFile(C:\Users\Clint\.kre\packages\KRE-svrc50-
x86.0.1-alpha-build-0446\bin\Microsoft.Framework.Runtime.dll)
Information: Project root is W:\repositories\Home\samples\HelloMvc
Information: Walking dependency graph for 'HelloMvc K,Version=v1.0'.
Information: [ProjectReferenceDependencyProvider]: HelloMvc 0.1-alpha-SNAPSHOT
Information: [NuGetDependencyResolver]: Microsoft.AspNet.Diagnostics 0.1-alpha-b
uild-0623, Microsoft.AspNet.Hosting 0.1-alpha-build-0519, Microsoft.AspNet.Mvc 0
.1-alpha-build-1140, Microsoft.AspNet.Server.WebListener 0.1-alpha-build-0469, M
icrosoft.AspNet.FeatureModel 0.1-alpha-build-0413, Microsoft.AspNet.Http 0.1-alp
ha-build-0413, Microsoft.AspNet.PipelineCore 0.1-alpha-build-0413, System.Collec
tions 4.0.0.0, System.ComponentModel 4.0.0.0, System.Diagnostics.Debug 4.0.10.0,
 System.Diagnostics.Tools 4.0.0.0, System.Globalization 4.0.10.0, System.IO 4.0.
0.0, System.IO.FileSystem 4.0.10.0, System.Linq 4.0.0.0, System.Reflection 4.0.1
0.0, System.Resources.ResourceManager 4.0.0.0, System.Runtime 4.0.20.0, System.R
untime.Extensions 4.0.10.0, System.Threading 4.0.0.0, System.Threading.Tasks 4.0
.10.0, Microsoft.AspNet.Security.DataProtection 0.1-alpha-build-0150, Microsoft.
Framework.ConfigurationModel 0.1-alpha-build-0223, Microsoft.Framework.Dependenc
yInjection 0.1-alpha-build-0362, Microsoft.Framework.Logging 0.1-alpha-build-016
8, Microsoft.Framework.Runtime.Interfaces 0.1-alpha-build-0421, System.Console 4
.0.0.0, Common 1.0.0, Microsoft.AspNet.FileSystems 0.1-alpha-build-0159, Microso
ft.AspNet.Mvc.Core 0.1-alpha-build-1140, Microsoft.AspNet.Mvc.ModelBinding 0.1-a
lpha-build-1140, Microsoft.AspNet.Mvc.Razor 0.1-alpha-build-1140, Microsoft.AspN
et.Mvc.Razor.Host 0.1-alpha-build-1140, Microsoft.AspNet.Razor 0.1-alpha-build-0
193, Microsoft.AspNet.RequestContainer 0.1-alpha-build-0519, Microsoft.AspNet.Ro
uting 0.1-alpha-build-0525, Microsoft.AspNet.HttpFeature 0.1-alpha-build-0413, M
icrosoft.Net.Server 0.1-alpha-build-0469, Microsoft.Win32.Primitives 4.0.0.0, Sy
stem.Collections.Concurrent 4.0.0.0, System.Diagnostics.Contracts 4.0.0.0, Syste
m.Runtime.Handles 4.0.0.0, System.Runtime.InteropServices 4.0.20.0, System.Secur
ity.Principal 4.0.0.0, System.Text.Encoding 4.0.20.0, System.Text.Encoding.Exten
sions 4.0.10.0, System.Threading.Overlapped 4.0.0.0, System.Threading.ThreadPool
 4.0.10.0, System.Reflection.TypeExtensions 4.0.0.0, System.Globalization.Extens
ions 4.0.0.0, System.Security.Claims 0.1-alpha-build-0257, System.IO.FileSystem.
Primitives 4.0.20.0, System.Reflection.Primitives 4.0.0.0, System.Security.Crypt
ography 4.0.0.0, System.ApplicationContext 4.0.0.0, System.Reflection.Extensions
 4.0.0.0, Microsoft.AspNet.Security 0.1-alpha-build-0453, Microsoft.CSharp 4.0.0
.0, Newtonsoft.Json 5.0.8, System.Dynamic.Runtime 4.0.0.0, System.Linq.Expressio
ns 4.0.0.0, System.Reflection.Emit.ILGeneration 4.0.0.0, System.Reflection.Emit.
Lightweight 4.0.0.0, System.Security.Cryptography.HashAlgorithms.SHA2 4.0.0.0, M
icrosoft.DataAnnotations 0.1-alpha-build-0099, System.Runtime.Serialization.Prim
itives 4.0.0.0, K.Roslyn 0.1-alpha-build-0129, System.Threading.Thread 4.0.0.0,
System.Text.RegularExpressions 4.0.0.0, System.Net.Primitives 4.0.10.0, System.S
ecurity.Cryptography.X509Certificates 4.0.0.0, System.Security.SecureString 4.0.
0.0, System.IO.Compression 4.0.0.0, System.Security.Cryptography.RandomNumberGen
erator 4.0.0.0, System.ObjectModel 4.0.0.0, Microsoft.DataAnnotations.Core 0.1-a
lpha-build-0099, Microsoft.DataAnnotations.Supplemental 0.1-alpha-build-0099, Mi
crosoft.CodeAnalysis.Common 0.7.4050915-beta, Microsoft.CodeAnalysis.CSharp 0.7.
4050915-beta, System.Security.Cryptography.Encoding 4.0.0.0, Microsoft.Bcl.Immut
able 1.1.20-beta, Microsoft.Bcl.Metadata 1.0.11-alpha
Information: RootHost.Load name=Microsoft.Framework.Runtime.resources
Information: Loading Microsoft.Framework.Runtime.resources for 'K,Version=v1.0'.

Information: RootHost.Load name=Microsoft.Framework.Runtime.Roslyn
Information: RootHost Assembly.LoadFile(C:\Users\Clint\.kre\packages\KRE-svrc50-
x86.0.1-alpha-build-0446\bin\Microsoft.Framework.Runtime.Roslyn.dll)
Information: RootHost.Load name=Microsoft.Framework.Runtime.resources
Information: Loading Microsoft.Framework.Runtime.resources for 'K,Version=v1.0'.

Information: Resolved dependencies for HelloMvc in 1583ms
Information: Loading entry point from Microsoft.AspNet.Hosting
Information: RootHost.Load name=Microsoft.AspNet.Hosting
Information: Loading Microsoft.AspNet.Hosting for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Hosting in
 1ms
Information: Load took 1586ms
Information: RootHost.Load name=Microsoft.Framework.ConfigurationModel
Information: Loading Microsoft.Framework.ConfigurationModel for 'K,Version=v1.0'
.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.Framework.Configu
rationModel in 1ms
Information: RootHost.Load name=Microsoft.Framework.DependencyInjection
Information: Loading Microsoft.Framework.DependencyInjection for 'K,Version=v1.0
'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.Framework.Depende
ncyInjection in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Security.DataProtection
Information: Loading Microsoft.AspNet.Security.DataProtection for 'K,Version=v1.
0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Security.D
ataProtection in 1ms
Information: RootHost.Load name=Microsoft.Framework.Logging
Information: Loading Microsoft.Framework.Logging for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.Framework.Logging
 in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Http
Information: Loading Microsoft.AspNet.Http for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Http in 1m
s
Information: RootHost.Load name=Microsoft.AspNet.PipelineCore
Information: Loading Microsoft.AspNet.PipelineCore for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.PipelineCo
re in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Server.WebListener
Information: Loading Microsoft.AspNet.Server.WebListener for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Server.Web
Listener in 1ms
Information: RootHost.Load name=Microsoft.Net.Server
Information: Loading Microsoft.Net.Server for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.Net.Server in 1ms

Information: RootHost.Load name=HelloMvc
Information: Loading HelloMvc for 'K,Version=v1.0'.
Information: [RoslynCompiler]: Found project 'HelloMvc' framework=K,Version=v1.0

Information: [RoslynCompiler]: Loading dependencies for 'HelloMvc'
Information: [RoslynCompiler]: Completed loading dependencies for 'HelloMvc' in
7ms
Information: [RoslynCompiler]: Compiling 'HelloMvc'
Information: [RoslynCompiler]: Exported References 112
Information: Assembly Neutral References 32
Information: Found 32 Assembly Neutral References in 960ms
Information: [RoslynAssemblyLoader]: Emitting assembly for HelloMvc
Information: [RoslynAssemblyLoader]: Emitted HelloMvc in 59ms
Information: [LazyRoslynAssemblyLoader]: Finished loading HelloMvc in 2428ms
Information: RootHost.Load name=Microsoft.AspNet.Mvc.Core
Information: Loading Microsoft.AspNet.Mvc.Core for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Mvc.Core i
n 1ms
Information: RootHost.Load name=Microsoft.AspNet.Diagnostics
Information: Loading Microsoft.AspNet.Diagnostics for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Diagnostic
s in 1ms
Information: RootHost.Load name=Microsoft.AspNet.RequestContainer
Information: Loading Microsoft.AspNet.RequestContainer for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.RequestCon
tainer in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Mvc
Information: Loading Microsoft.AspNet.Mvc for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Mvc in 1ms

Information: RootHost.Load name=Microsoft.AspNet.Security
Information: Loading Microsoft.AspNet.Security for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Security i
n 1ms
Information: RootHost.Load name=Microsoft.AspNet.Mvc.ModelBinding
Information: Loading Microsoft.AspNet.Mvc.ModelBinding for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Mvc.ModelB
inding in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Mvc.Razor
Information: Loading Microsoft.AspNet.Mvc.Razor for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Mvc.Razor
in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Mvc.Razor.Host
Information: Loading Microsoft.AspNet.Mvc.Razor.Host for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Mvc.Razor.
Host in 1ms
Information: RootHost.Load name=Microsoft.AspNet.Razor
Information: Loading Microsoft.AspNet.Razor for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Razor in 1
ms
Information: RootHost.Load name=Microsoft.AspNet.Routing
Information: Loading Microsoft.AspNet.Routing for 'K,Version=v1.0'.
Information: [NuGetAssemblyLoader]: Finished loading Microsoft.AspNet.Routing in
 1ms
Started

@masaeedu
Copy link

Is there a workaround for this?

@aspnet-hello
Copy link

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

natemcmaster pushed a commit that referenced this issue Nov 30, 2018
Remove unnecessary using directives
natemcmaster pushed a commit that referenced this issue Nov 30, 2018
Added Unit Tests for form field based HTTP Method Override
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants