3

I have built a WCF application which has Global.asax file. I have added AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required) on top of service class and added into web.config as well. Global.asax Application_Start event fires when debugging the application but when it deployed in the IIS7 its not firing.

Any help or idea?

Thank you.

user2822319
  • 521
  • 1
  • 5
  • 8

1 Answers1

0

If you make a request to your app does the "Application_Start" fire then? I don't believe it will be started until the first request is made.

Application level events only need proper naming to work. Is your codebehind class being designated in your Global.asax file?

 <%@ Application Inherits="YourNamespace.YourApplicationClass" Language="C#" %>

(Or)

becuase project is compiled first and then you have add or modify or changed location of global.asax.cs.

Solution :- Just remove debug folder. Clean project and then rebuild whole project.

Edit

When using the response object from an aspx page, its codebehind class or a user control, the response object is directly available because all these derive from the page object.

When using the response object in your own class, the object is not available, but you can access it:

HttpContext.Current.Response. -> something

Take a look at here

Global ASAX - get the server name

Community
  • 1
  • 1
Vignesh Kumar A
  • 26,868
  • 11
  • 59
  • 105