以前工作的asp.net webforms应用程序现在抛出这个错误:

系统。MissingMethodException:方法未找到

DoThis方法在同一个类上,它应该可以工作。

我有一个通用的处理程序,这样:

public class MyHandler: IHttpHandler
{
    public void Processrequest(HttpContext context)
    {
      // throws error now System.MissingMethodException: 
      // Method not found.
      this.DoThis(); 
    }

    public void DoThis(){ ... }
}

当前回答

为了子孙后代,我在使用azure持久函数/持久任务框架时遇到了这个问题。原来我在本地安装了一个过时的azure函数运行时版本。更新它解决了这个问题。

其他回答

我遇到了这个问题,对我来说,它是一个项目,在例子中使用一个列表。传感器命名空间和另一种类型实现了ISensorInfo接口。类Type1SensorInfo,但是这个类在Example.Sensors.Type1的命名空间中更深一层。当试图将Type1SensorInfo反序列化到列表中时,会抛出异常。当我使用Example.Sensors添加时。输入1到ISensorInfo接口,没有更多的异常!

namespace Example
{
    public class ConfigFile
    {
        public ConfigFile()
        {
            Sensors = new List<ISensorInfo<Int32>>();
        }
        public List<ISensorInfo<Int32>> Sensors { get; set; }
     }
   }
}

**using Example.Sensors.Type1; // Added this to not throw the exception**
using System;

namespace Example.Sensors
{
    public interface ISensorInfo<T>
    {
        String SensorName { get; }
    }
}

using Example.Sensors;

namespace Example.Sensors.Type1
{
    public class Type1SensorInfo<T> : ISensorInfo<T>
    {
        public Type1SensorInfo() 
    }
}

为了子孙后代,我在使用azure持久函数/持久任务框架时遇到了这个问题。原来我在本地安装了一个过时的azure函数运行时版本。更新它解决了这个问题。

我在同一个程序集中引用了一个文件,而不是一个单独的dll,就发生了这种情况。一旦我从项目中排除了该文件,然后又将其包含进来,一切都工作得很好。

重新启动Visual Studio实际上为我解决了这个问题。我认为这是由于旧的程序集文件仍然在使用造成的,执行“清洁构建”或重新启动VS应该会修复它。

在我的情况下,根本没有代码更改,突然一个服务器开始得到这个,只有这个异常(所有服务器都有相同的代码,但只有一个开始有问题):

System.MissingMethodException: Method not found: '?'.

栈:

Server stack trace: 
   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 myAccountSearch.AccountSearch.searchtPhone(searchtPhoneRequest request)
   at myAccountSearch.AccountSearchClient.myAccountSearch.AccountSearch.searchtPhone(searchtPhoneRequest request)
   at myAccountSearch.AccountSearchClient.searchtPhone(String ID, String HashID, searchtPhone Phone1)
   at WS.MyValidation(String AccountNumber, String PhoneNumber)

我认为这个问题是AppPool被破坏了——我们每天凌晨3点自动回收AppPool,这个问题从凌晨3点开始,然后在第二天凌晨3点自行结束。