Problems with IIS
I have a web service application which will be running on IIS, but I am having problems when running it. I have the following scenario:
- When running the application on IIS on Windows 7 by copying the application in the inetpub/wwwroot folder- i am getting the error "An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. "
- When running the same application by pressing "Run" in Visual Studio (this assign a temporary port) the webservice is diplayed in the browser normally
- when repeating the above in a Win XP PC, all both scenarios work fine.
Do you have an idea what might be the problem? Maybe some settings in IIS 7? thanks
UPDATE - Event Viewer Log
Event code: 3008 Event message: A configuration error has occurred. Event time: 10/06/2010 20:33:10 Event time (UTC): 10/06/2010 18:33:10 Event ID: 7b4166753a6d4d41bd9b8709d24332f4 Event sequence: 4 Event 开发者_C百科occurrence: 1 Event detail code: 0
Application information: Application domain: /LM/W3SVC/1/ROOT/SSMT_Service-4-129206683902187500 Trust level: Full Application Virtual Path: /SSMT_Service Application Path: C:\inetpub\wwwroot\SSMT_Service\ Machine name: SANDRO-PC
Process information: Process ID: 5024 Process name: w3wp.exe Account name: IIS APPPOOL\DefaultAppPool
Exception information: Exception type: ConfigurationErrorsException Exception message: Could not load file or assembly 'NHunspell' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Request information: Request URL: http://localhost/SSMT_Service/ProcessImage.asmx Request path: /SSMT_Service/ProcessImage.asmx User host address: ::1 User:
Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\DefaultAppPoolThread information: Thread ID: 5 Thread account name: IIS APPPOOL\DefaultAppPool Is impersonating: False Stack trace: at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
An attempt was made to load a program with an incorrect format. - This typically for me means you are running this under the wrong bitness. Go to the app pool for this application, open its advanced settings and flip the bitness property [Enabled 32-bit Applications].
VS will attempt to launch its wp in the correct bitness but when you are running under the default app pool you get whatever your site default is, which is probably wrong for your application. You can also try flipping your code to force 32 or 64 bit if you don't have access to the app pool settings, or have CORFLAGS force bitness on your applications dlls so you load the correct dll.
Who knows - you need the stack trace. Fire up event viewer and look at the 'Application' log.
精彩评论