本文介绍了无法将类型为“ASP._global_asax”的对象强制转换为“microsoft.practices.compositeweb.webclientapplication”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个dot.net项目,Global.asax文件在那里,但Global.asax.cs(vb)不存在。所以我删除了旧的Global.asax文件并使用visualstudio 2013中的全局模板创建了新文件,因为我想在Global.asax.vb的APPlication_Start事件中执行一些功能 代码GLOBL .asax <%@ Application Codebehind =Global.asax.vbInherits =WebApp.Global_asaxLanguage =vb%> 代码如果Global.asax.vb 公共类Global_asax 继承System.Web .HttpApplication Sub Application_Start(ByVal sender As Object,ByVal e As EventArgs) Dim key As String = String.Empty If(key Is Nothing)OrElse(key is)然后 key = GetJwtTokenFromSource(4201.omse.jul.web,read_master_reference,, ,) key = Convert.ToString(Bearer)& key 结束如果 CallNM(NMPCodes.LEVEl,key) CallNM(MMPCodes.GROUP,key ) End Sub 任务,我想在开始时执行即使运行正常但在成功执行此块之后我到了下面例外。 '无法将类型为'ASP._global_asax'的对象强制转换为'Microsoft.Practices.CompositeWeb.WebClientApplication' 我尝试了什么: 如果我从Microsoft.Practices.CompositeWeb.WebClientApplication中获取GLOBAL.ASAX GLOBL代码.asax <%@ Application Codebehind =Global.asax.vbInherits =Microsoft.Practices。 CompositeWeb.WebClientApplicationLanguage =vb%> 然后Application_start事件未触发。I have a dot.net project in which Global.asax file was there but Global.asax.cs(vb) was not there. So I deleted the old one Global.asax file and created the new one using the Global template in visualstudio 2013 because i want to perform some function in APPlication_Start event of Global.asax.vbcode of GLOBL .asax<%@ Application Codebehind="Global.asax.vb" Inherits="WebApp.Global_asax" Language="vb" %>Code if Global.asax.vbPublic Class Global_asax Inherits System.Web.HttpApplication Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim key As String = String.Empty If (key Is Nothing) OrElse (key Is "") Then key = GetJwtTokenFromSource("4201.omse.jul.web", "read_master_reference","", "", "") key = Convert.ToString("Bearer ") & key End If CallNM(NMPCodes.LEVEl, key) CallNM(MMPCodes.GROUP, key) End Subtask that i want to perform in start even is running fine but after successfull execution of this block I am getting below exception.'Unable to cast object of type 'ASP._global_asax' to type 'Microsoft.Practices.CompositeWeb.WebClientApplication'What I have tried:If I am inherting GLOBAL.ASAX from Microsoft.Practices.CompositeWeb.WebClientApplication code of GLOBL .asax<%@ Application Codebehind="Global.asax.vb" Inherits="Microsoft.Practices.CompositeWeb.WebClientApplication" Language="vb" %> Then Application_start event is not firing.推荐答案 <%@ Application Codebehind="Global.asax.vb" Inherits="WebApp.Global_asax" Language="vb" %> Global.asax.vb: Global.asax.vb:Public Class Global_asax Inherits Microsoft.Practices.CompositeWeb.WebClientApplication ...End Class Hi,I am working on an obsolete project ( in VS 2008) and today while migrating my website to IIS 7 i faced this issue.I did two thingsa. Checked and removed unrequired default document from IIS.b. Deleted the precompiledapp.config and it start to work as before.Hope it works for you.ThanksRajkamal 这篇关于无法将类型为“ASP._global_asax”的对象强制转换为“microsoft.practices.compositeweb.webclientapplication”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 19:53