C# WCF部署到azure实体框架方法返回异常

C# WCF部署到azure实体框架方法返回异常,c#,mysql,wcf,entity-framework,azure,C#,Mysql,Wcf,Entity Framework,Azure,我正在为Windows Phone应用程序开发WCF 数据库是MySQL,因此我使用ADO.net实体框架来访问数据。 它对当地的环境很有效 然而,当我使用包实例将它们部署到azure时,我得到了一个使用实体框架的方法的例外。其他不需要数据库数据的方法返回的值很好,比如:getHello() 我正在使用visual studio的最新mysql连接器 为了进行测试,我使用了WCFTestClient.exe。这是我调用该方法时返回的结果: The server was unable to pro

我正在为Windows Phone应用程序开发WCF

数据库是MySQL,因此我使用ADO.net实体框架来访问数据。 它对当地的环境很有效

然而,当我使用包实例将它们部署到azure时,我得到了一个使用实体框架的方法的例外。其他不需要数据库数据的方法返回的值很好,比如:getHello()

我正在使用visual studio的最新mysql连接器

为了进行测试,我使用了WCFTestClient.exe。这是我调用该方法时返回的结果:

The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IService1.getUUser(Int32 userUid)
   at Service1Client.getUUser(Int32 userUid)
由于内部错误,服务器无法处理该请求。有关错误的详细信息,请在服务器上启用IncludeExceptionDetailInFaults(从ServiceBehaviorAttribute或从配置行为),以便将异常信息发送回客户端,或者根据Microsoft.NET Framework 3.0 SDK文档启用跟踪,并检查服务器跟踪日志。
服务器堆栈跟踪:
在System.ServiceModel.Channels.ServiceChannel.ThrowiffaultUnderstanding处(消息回复、消息故障、字符串操作、消息版本、故障转换器故障转换器)
位于System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)
在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出、时间跨度超时)
位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作)
位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)
在[0]处重试异常:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
at System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)
在IService1.getUUser(Int32 userUid)
在Service1Client.getUUser(Int32 userUid)上
服务是

我尝试修复的方法有:

getUUser()-输入任何整数1到3将返回帐户详细信息

updateLoc()-在uid、lat、longit(插入记录)中输入任何整数

欢迎您访问该服务以帮助我。

已解决

我确保MySQL.Data.dll、MySQL.Web.dll、MySQL.Data.Entity.dll和System.Data.Entity.dll System.Data.Entity.Design System.Data.dll都是本地复制的(Copy local设置为true)

将以下内容添加到web.config文件:

  <system.data>
      <DbProviderFactories>
        <clear />
        <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
        description=".Net Framework Data Provider for MySQL"
        type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, 
        Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      </DbProviderFactories>
    </system.data>