I'm using ASP.NET MVC 3 and have learnt through the MVC Music Store and other sources. I was able to create a database and have it live but the weird thing was about 5 hours after it was live it went down and had the following error and stack trace:
Note: This also seems to be the case whenever I publish the site. I have to go and delete the database manually for it to re create it and then it will work. But now that I'm live I can't do that because data is already being stored in there that I don't want to redo.
File already exists. Try using a different database name. [ File name = C:\HostingSpaces\...\wwwroot\App_Data\Test.sdf ]
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.Data.SqlServerCe.SqlCeException: File already exists. Try using a different database name. [ File name = C:\HostingSpaces\mtnp55\pricexperience.com\wwwroot\App_Data\Test.sdf ]
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlCeException (0x80004005): File already exists. Try using a different database name. [ File name = C:\HostingSpaces\...\wwwroot\App_Data\Test.sdf ]]
System.Data.SqlServerCe.SqlCeEngine.ProcessResults(IntPtr pError, Int32 hr) +72
System.Data.SqlServerCe.SqlCeEngine.CreateDatabase() +658
System.Data.SqlServerCe.SqlCeProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 timeOut, StoreItemCollection storeItemCollection) +194
System.Data.Objects.ObjectContext.CreateDatabase() +84
System.Data.Entity.Internal.DatabaseOperations.Create(ObjectContext objectContext) +8
System.Data.Entity.Database.Create() +76
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +387
System.Data.Entity.<>c__DisplayClass2`1.<SetInitializerInternal>b__0(DbContext c) +75
System.Data.Entity.Internal.<>c__DisplayClass5.<PerformDatabaseInitialization>b__3() +19
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +72
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +169
System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +7
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +118
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +190
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63
PriceXperience.Controllers.AppsController.ViewLeaderboards(Int32 gameId) in C:\Users\Public\Documents\Development\...\Controllers\AppsController.cs:42
lambda_method(Closure , ControllerBase , Object[] ) +101
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
I've tried many things but still cannot figure out why it does this. I do have a database initialize.
System.Data.Entity.Database.SetInitializer<MobileEntities>(new SampleData());
public class SampleData : CreateDatabaseIfNotExists<MobileEntities>
The code that runs when I try to access the db is the following:
public ActionResult ViewLeaderboards(int gameId)
{
var leaderboards = from u in mobileDB.Scores
where u.GameId == gameId
select u;
return View(leaderboards.OrderByDescending(u => u.Score).ToList());
}
When publishing you need to be sure to REMOVE the Initializer from the Global.asax. The Initializer is only for populating test data, and should not be in use during production. I also remember reading somewhere that setting the Initializer to null might work.
Database.SetInitializer<MyContext>(null);
Or just comment out the line where you call SetInitializer before publishing. I also exclude my Initializer class from the project before publishing.
The default strategy for Code First contexts is an instance of CreateDatabaseIfNotExists.
So it is necessary to include the
Database.SetInitializer<MyContext>(null);
so that the default initializer is not called which might then give an error!
Also, it is necessary to include the generic tag when setting it to null or the compiler will give an error.
Related
I am getting generic error message System.Linq.Dynamic.ParseException: Identifier expected.
What should I check in order to resolve it? The error isn't very detailed.
I did check the source and the selector params from the ParseLambda method and T-SQL they carry seems valid and execute fine in the SQL Management Studio.
Server Error in '/' Application.
________________________________________
Identifier expected
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.Linq.Dynamic.ParseException: Identifier expected
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ParseException: Identifier expected]
System.Linq.Dynamic.ExpressionParser.ValidateToken(TokenId t, String errorMessage) in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:1952
System.Linq.Dynamic.ExpressionParser.GetIdentifier() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:1941
System.Linq.Dynamic.ExpressionParser.ParseNew() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:1038
System.Linq.Dynamic.ExpressionParser.ParseIdentifier() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:966
System.Linq.Dynamic.ExpressionParser.ParsePrimaryStart() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:867
System.Linq.Dynamic.ExpressionParser.ParsePrimary() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:848
System.Linq.Dynamic.ExpressionParser.ParseUnary() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:844
System.Linq.Dynamic.ExpressionParser.ParseMultiplicative() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:798
System.Linq.Dynamic.ExpressionParser.ParseAdditive() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:771
System.Linq.Dynamic.ExpressionParser.ParseComparison() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:702
System.Linq.Dynamic.ExpressionParser.ParseLogicalAnd() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:689
System.Linq.Dynamic.ExpressionParser.ParseLogicalOr() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:676
System.Linq.Dynamic.ExpressionParser.ParseExpression() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:662
System.Linq.Dynamic.ExpressionParser.Parse(Type resultType) in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:629
System.Linq.Dynamic.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:166
System.Linq.Dynamic.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:161
System.Linq.Dynamic.DynamicQueryable.Select(IQueryable source, String selector, Object[] values) in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\DynamicQuery\Dynamic.cs:34
WebUI.Controllers.VoterController.ExportToExcel() in C:\Projects\EDgE\EDgE-EDGE_Parsippany\WebUI\Controllers\VoterController.cs:2288
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.<>c__DisplayClass1.<WrapVoidAction>b__0(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
Castle.Proxies.ControllerActionInvokerProxy.InvokeActionMethod_callback(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +42
Castle.Proxies.Invocations.ControllerActionInvoker_InvokeActionMethod.InvokeMethodOnTarget() +208
Castle.DynamicProxy.AbstractInvocation.Proceed() +56
Glimpse.Mvc3.Interceptor.InvokeActionMethodInterceptor.Intercept(IInvocation invocation) +408
Castle.DynamicProxy.AbstractInvocation.Proceed() +94
Castle.Proxies.ControllerActionInvokerProxy.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +222
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
ParseException at line 1952:
Call Stack exception source:
OK, I don't know if this is Microsoft bug in the System.Linq.Dynamic library or misuse of SQL column alias names, but in this special case the parser fails:
Select Col1 as First_Name, Col2 as Last_Name, col3 as 2012_P_Customer
From MyTable
The System.Linq.Dynamic parser fails when parsing Col3 as 2012_P_Customer. It did not like the 2012 number as prefix.
When I changed it to "col3 as P_Customer_2012 " it worked fine.
I knew that prefixing SQL column is a bad practice, but I did not know that the same is valid for the column alias.
I have a web application that is not giving me any problems on my computer, but when I deploy it to the server I get this error. It doesn't give me any source code lines to check and I don't have any idea why it may be happening
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a9dc635c\ccb3814\App_Web_item.cshtml.f0356b3c.uyw8roer.0.cs Line: 0
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page__AssemblyResource_MyProject_Web_Mvc__Version_1_0_0_0__Culture_neutral__PublicKeyToken_null_Views_LeagueGlobal_Item_cshtml.Execute() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a9dc635c\ccb3814\App_Web_item.cshtml.f0356b3c.uyw8roer.0.cs:0
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +195
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +383
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +32
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +977396
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +977396
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +964636
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +53
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +53
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
I run into the same issue. Unfortunately the stack trace isn't very helpful in this case. The exception is happening for sure in the view, what it was in my case:
#Model.SomeProperty.Trim()
And Model.SomeProperty was null. As there is no way how to debug it; I recommend binary split approach:
save your view somewhere else
remove one-by-one logical parts from your view
after each removal save your view and retest
if the exception is no longer reproducible, the NullReferenceException happened in the block you've removed; so add it back and remove logical parts inside this block until you isolate the line causing an exception
Its lame I know, but I found no other way - btw. this is what I got for doing controller job in view.
Go to line 0 of your source file at:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a9dc635c\ccb3814\App_Web_item.cshtml.f0356b3c.uyw8roer.0.cs
Then, use this to pin-point where exactly the exception happens in your code block:
try
{
...
}
catch (NullReferenceException ex)
{
ShowMessageBox("Error" + ex.Message);
}
Check that:
You've initiated the variables that you're manipulating.
Variables that you're using have not become null since deploying it to the server.
You are not using variables outside of your scope.
I am using MVC4 with VS 2010. I have an async action that I am trying to get working. My controller inherits from AsyncController and I have the ~Async and ~Completed methods. I am able to execute my async action correctly in a sample test project. But when I run it as part of my core web app it get this exception
[InvalidOperationException: The asynchronous action method 'Complete' cannot be executed synchronously.]
System.Web.Mvc.Async.AsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +133
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +39
I am using Unity for Dependency Injection, ActionAttributeFilters and MVCSiteMapProvider, I am wondering if one of these is causing the above issue. Any help is appreciated.
Thanks
The whole stack trace
[InvalidOperationException: The asynchronous action method 'Complete' cannot be executed synchronously.]
System.Web.Mvc.Async.AsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +133
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +978122
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +978400
NotFoundMvc.ActionInvokerWrapper.InvokeActionWith404Catch(ControllerContext controllerContext, String actionName) in c:\Users\Andrew Davey\projects\opensource\NotFoundMvc\src\NotFoundMvc\ActionInvokerWrapper.cs:40
NotFoundMvc.ActionInvokerWrapper.InvokeAction(ControllerContext controllerContext, String actionName) in c:\Users\Andrew Davey\projects\opensource\NotFoundMvc\src\NotFoundMvc\ActionInvokerWrapper.cs:21
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +53
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +53
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
It looks like the NotFoundMVC Lib cause this problem. uninstall this package you will get work fine!
I am trying to deploy my MVC3 app on a shared host. I've got .Net4 on the shared host and I have worked through the various bin deploy steps cited all over the internet. The problem is that I don't get an error when I try to access the site, I just get a message saying directory browsing is not allowed. I have uploaded the files but its like the server doesn't know what to do when it gets there. I would appreciate any tips anyone has to give regarding this...I need to show a demo today.
Thanks !
Edit:
So I managed to figure out that my host placed my account on a server running IIS6 and therefore cannot process extensionless urls, so I modified my routing table to append a .aspx to the controller name so that IIS can process the request. Now I get this error (which I guess has to do with EF4) when I try to access the url
Attempt by method 'System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(System.Data.Common.DbConnection)' to access method 'System.Data.Common.DbProviderServices.GetProviderFactory(System.Data.Common.DbConnection)' failed.
[MethodAccessException: Attempt by method 'System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(System.Data.Common.DbConnection)' to access method 'System.Data.Common.DbProviderServices.GetProviderFactory(System.Data.Common.DbConnection)' failed.]
System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection) +52
System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +63
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +157
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +51
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +117
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +407
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +17
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +315
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
WebShop.Controllers.HomeController.Index() in C:\Users\owner\Documents\My Web Sites\WebShop\WebShop\WebShop\Controllers\HomeController.cs:18
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329
System.Web.Mvc.Controller.ExecuteCore() +115
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8683441
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Anyone know how I can sort this out?
Thanks
It's not enough to move files to the host, you have to tell IIS your files are an application. That's the most common reason for the directory browsing error. Your hoster should have help pages on deploying ASP.NET applications.
I uploaded an ASP.NET MVC site to Azure, which works just fine in the emulator. When I run it on Azure however I get the error "Method not found: 'System.Object System.Reflection.PropertyInfo.GetValue(System.Object)'"
Stack Trace:
[MissingMethodException: Method not found: 'System.Object System.Reflection.PropertyInfo.GetValue(System.Object)'.]
FW.Helpers.ListHelper.ToSelectListItemModels(IEnumerable`1 list, Expression`1 valueProperty, Expression`1 textProperty) +0
My.Application.MyBuilderService.GetFilterList() +1444
My.Application.MyBuilderService.BuildMyViewModel(Query query) +547
My.Appsite.Controllers.MyController.BuildMyViewModel(Query query) in C:\Users\user\documents\visual studio 2010\Projects\WindowsAzureProject3\MvcWebRole1\Controllers \MyController.cs:40
lambda_method(Closure , ControllerBase , Object[] ) +127
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +125
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +640
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691
System.Web.Mvc.Controller.ExecuteCore() +162
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +305
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
It is a normal Windows and .NET installation. Reflection is supported. Clearly there is another factor here. We don't have enough information to help however. A stack trace is important for things like this.
You probably need to make sure the DLLs you use all have the Copy Local property set to True. Like:
http://stevesmithblog.com/blog/asp-net-mvc-2-and-windows-azure/