I'm migrating an ASP .NET 2.0 WebSite to WebRole (ASP.NET 4.0 and VS2010). After created new web role, I moved all files and folders from website to WebRole then reference all needed dlls. I build and run web role stand alone and everything ok without problems. But when 开发者_运维问答I build and run WindowsAzureProject, below errors come up
[fabric] Role state Stopping
[fabric] Role state Stopped
[fabric] Role state Aborted
[fabric] Role state Teardown
[fabric] Role state Destroyed
[runtime] Role entrypoint could not be created:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
and the status "Operation was canceled"
It takes me days to resolve but nothing found. I did set "Copy local" to true for all reference dlls but it doesn't effect also. I've just thought spring.core and spring.aop caused the error but I don't know how to debug and catching where it crash
Please help me in this case. Thanks a lot and sorry for my poor English
The easiest way to debug this problem is to enable Intelitrace for your deployment and debug it that way. This is a good post on how to do this. You can also enable diagnostics and log it after wrapping the starup in a try catch. Although, Intelitrace is the best way to go.
Another point to note is that the dependencies of your dependencies need to be met and explicitly referenced in your web role, i.e if you reference a dll or another project in your solution, you must include the dependencies of that project or dll in your web role references with the CopyLocal set to true.
This is because the Azure packager does not scan the dependency tree for you, it will only look at the first level of references i.e. those of your role, and therefore dlls further down the tree may be missing and you will get a type load exception.
Scott's answer should help you find which dll is missing. Hope that helps.
Have you perhaps deleted the WebRole.cs file?
精彩评论