微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WCF System.TypeLoadException:访问被拒绝:

如何解决WCF System.TypeLoadException:访问被拒绝:

我有一个自托管的 WCF 服务器,它在我的开发机器上运行良好。

但是,当我在 Windows 2012 服务器上运行它时,出现此错误

System.TypeLoadException: Access is denied: 'Castle.DynamicProxy.Internal.CompositionInvocation'.

当我将 4.5 服务迁移到 .net 4.8 时出现此错误 有什么线索吗?

添加:这是失败的起始代码

var binding = new BasicHttpBinding
        {
            Security =
            {
                Mode = BasicHttpSecurityMode.Transport
            },MaxReceivedMessageSize = int.MaxValue,MaxBufferPoolSize = int.MaxValue,OpenTimeout = TimeSpan.FromMinutes(1),CloseTimeout = TimeSpan.FromMinutes(1),SendTimeout = TimeSpan.FromMinutes(20),ReceiveTimeout = TimeSpan.FromMinutes(20),};
        var endpointAddress = new EndpointAddress(Configuration.PmsUrl);
        var client = new WebServiceRouterSoapClient(binding,endpointAddress);
        client.Endpoint.Behaviors.Add(new LoggingEndpointBehavIoUr());

        try
        {
            var response = action(client);
            client.Close();
            if(response.ExceptionCode > 0)
            {
                throw new Exception($"Exception {response.ExceptionCode} - {response.ExceptionDescription}");
            }
        }
        catch(Exception ex)
        {
            Log.GetLog().Error(ex);
            client.Abort();
        }

谢谢。乔纳森

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。