我已经更新了我的模型并完成了重建项目(如stackoverflow所示),但没有任何好处。
我的ASP.NET wcf webservice在本地主机上工作正常。但是当我将它上传到AppHarbor(免费的asp.net网络托管服务)时,我得到一个例外(我称之为http://pizzaapp.apphb.com/Service1.svc/Login/123/1)我无法理解(如下所示)。这在我的本地主机上完美运行,所以上传后有什么问题?
请求错误服务器在处理请求时遇到错误。异常消息是'执行命令定义时发生错误。有关详细信息,请参阅内部异常。'。请参阅服务器日志以获取更多详异常堆栈跟踪是:
在System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,的CommandBehavior行为)在System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute [TResultType](ObjectContext的上下文中,ObjectParameterCollection的parameterValues)在System.Data.Entity.Core.Objects.ObjectQuery
1.<>c__DisplayClass3.<GetResults>b__2() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func
1 func,IDbExecutionStrategy executionStrategy,Boolean startLocalTransaction,Boolean releaseConnectionOnSuccess)System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass3.<GetResults>b__1() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func
1 operation)at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable
1 forMergeOption)在System.Data.Entity.Core.Objects.ObjectQuery1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0() at System.Lazy
1.CreateValue()在System.Lazy1.LazyInitValue() at System.Lazy
1.get_Value()在System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable
1源)在System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider .b__2 [TResult](IEnumerable1 sequence) at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable
1查询表达式queryRoot)在System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvide r.Execute [TResult]在WcfServicePizza在System.Linq.Queryable.SingleOrDefault [TSource](IQueryable`1源)(表达式表达)在System.Data.Entity.Internal.Linq.DbQueryProvider.Execute [TResult](表达式表达) .Service1.Login(字符串PHONENO,字符串password)在d:\ TEMP \ lmtrshzg.bwx \输入\ WcfServicePizza \ Service1.svc.cs:线37在SyncInvokeLogin(对象,对象[],对象[])中的System.ServiceModel .Dispatcher.SyncMethodInvoker.Invoke(对象实例,Object []输入,Object []和输出)位于System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&rpc)的System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&rpc)at at系统.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&rpc)位于System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&rpc),位于System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&rpc),位于System.ServiceModel.Dispatcher.Immu tableDispatchRuntime.ProcessMessage3在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&RPC)在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&RPC)(MessageRpc&RPC)在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&RPC)在System.ServiceModel.Dispatcher.MessageRpc.Process(布尔isOperationContextSet)
Web服务接口的代码
[OperationContract]
[WebInvoke(UriTemplate="SignUp",
Method="POST",
BodyStyle=WebMessageBodyStyle.WrappedRequest,
ResponseFormat=WebMessageFormat.Json,
RequestFormat=WebMessageFormat.Json)]
bool SignUp(Customer customer);
目前在服务器上运行的实现代码是:
public bool Login(string phoneNo, string password)
{
decimal phoneNoDecimal = Decimal.Parse(phoneNo);
DatabasePizzaEntities db = new DatabasePizzaEntities();
Customer customer = db.Customers.Where(c => c.PhoneNo==phoneNoDecimal && c.Password == password).SingleOrDefault();
if (customer == null)
return false;
return true;
}
内部例外:
Data.SqlClient.SqlException(0x80131904):在System.Data的System.Data.SqlClient.SqlConnection.OnError(SqlException异常,Boolean breakConnection,Action
1 wrapCloseInAction)\u000d\u000a at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)\ u000d \ u000a中无效的对象名'dbo.Customer'。\ u000d \ u000a System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,Boolean&dataReady).SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose)\ u000d \ u000a u000d \ u000a at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\ u000d \ u000a System.Data.SqlClient.SqlCommand.RunExecuteReaderTds上的System.Data.SqlClient.SqlDataReader.get_MetaData()\ u000d \ u000a at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)\ u000d \ u000a at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds (CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async,Int32 timeout,Task&task,Boolean asyncWrite,SqlDataReader ds)\ u000d \ u000a at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法,TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite)\u000d\u000a at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)\u000d\u000a at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)\u000d\u000a at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)\u000d\u000a at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\u000d\u000a at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c__DisplayClassb.<Reader>b__8()\u000d\u000a at System.Data.Entity.Infrastructure.Interception.InternalDispatcher
1.Dispatch [TInterceptionContext,TResult](Func1 operation, TInterceptionContext interceptionContext, Action
1正在执行,Action`1已执行)\ u000d \ u000a at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command,DbCommandInterceptionContext interceptionContext)\ u000d \ u000a at System System.Data.Common.DbCommand中的.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\ u000d \ u000a System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,CommandBehavior behavior)\ u000d \ u000aClientConnectionId:2c6eb8fd-ce5b-4866-8dc7-5ff565fb11d5 \ u000d \ .ExecuteReader(CommandBehavior behavior)\ u000d \ u000a u000a错误号码:208,州:1,等级:16“
本地主机和AppHarbor之间的区别在于您要连接的数据库。
错误消息是:
An error occurred while executing the command definition
这通常是数据库架构和映射文件之间的问题。
AppHarbor中的数据库架构是否与本地数据库中的架构不同?
这是“无效的对象名称”,或者: