StaticCompressionModule and DynamicCompressionModule on 32bit IIS and 64bit Windows - c#

I want to host a 32bit application in IIS 7 on 64 bit Windows 2008. When I visit the site with the default modules enabled I get this error -
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Module: DynamicCompressionModule
Notification: SendResponse
Handler: StaticFile
Error Code: 0x8007007e
If I remove the StaticCompressionModule and DynamicCompressionModule the site works.
Can I get it working without having to disable these modules?

Microsoft KB says
This problem occurs because the ApplicationHost.config file or the Web.config file references a module or a DLL that is invalid or that does not exist.
Try enabling 32bit application in Application Pool configuration
EDIT:
Found the folowing
For above specific error (mentioned in this example), DynamicCompressionModule module is causing the trouble. This is because of the XPress compression scheme module (suscomp.dll) which gets installed with WSUS. Since Compression schemes are defined globally and try to load in every application Pool, it will result in this error when 64bit version of suscomp.dll attempts to load in an application pool which is running in 32bit mode.
This module entry looks like:
Hence to get rid of this problem:
Ø Remove/Disable the XPress compression scheme from the configuration using the command below:
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-[name='xpress']
OR
Ø Use a 32bit version of suscomp.dll

In the end I couldn't get it to work without disabling these two modules. It's worth noting that if you're using Visual Studio to deploy your application to an IIS server, your applications config is going to overwrite what is on the server and thus, reenable the two modules. You need to disable the modules in your config file.

Related

Initializing an external COM object causes w3wp.exe to crash with "Access Violation" error

I'm trying to implement Brother b-Pac printing library for label printing devices into my web application. I need to create/load the label template on server and print from the client's machine over a browser.
My code is totally working on my development environment. It only occurs on the published version. It's an access denied error thrown when the COM object got called by the app. I suspect there's an inner exception I couldn't reach.
The event got logged as follows:
Faulting application name: w3wp.exe, version: 8.5.9600.16384
Faulting module name: bpac.dll, version: 3.2.0.20
Exception code: 0xc0000005
Fault offset: 0x0010beea
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Program Files (x86)\Common Files\Brother\b-PAC\bpac.dll
I also used DebugDiag on the dump file and here's the report. Though it says here debugger couldn't locate debug symbols for bpac.dll, so it may be incomplete (If it may help, I'd like to know where and how to get symbols for a 3rd party DLL)
Application is a multilayer ASP.NET MVC app targeting the .NET Framework 4.6.1, running on a virtual machine with Windows Server 2012 R2 (x64) and IIS 8. (If it matters the project is derived from this template)
I searched about the issue and tried the following solutions:
Give read/write permissions of wwwroot and DLL's own folder to the IIS APPPOOL/user of the faulting w3wp.exe.
Give same permissions to IIS_IUSRS, NETWORK, NETWORK SERVICE users.
Impersonate Administrator user.
Uninstall/install 32bit/64bit versions of the b-Pac SDK.
Change bitness of my ASP app and all projects within to x86/x64.
Enable 32bit on the Application Pool.
Patch the Windows for July 2018 update issue
Setting Anonymous Authentication, App pool identity etc. all to the default pool user.
Loading the DLL dynamically. (not sure if I did this correctly though)
The COM object I'm trying to initialize is bpac.Document. Interface is IDocument and the concrete class is DocumentClass. I wasn't familiar with any of these concepts before. And I'm still struggling to understand but I tried all of these following lines for initialization:
Document label = new Document();
DocumentClass label = new DocumentClass(); //embed interop types: false
IDocument label = new Document();
After that, I'm using label object to open a template and etc. But as soon as the application hits any of the above lines it crashes the server and restarts the app.
Incidentally, the DLL file is referenced as a COM library in my WebService (App) project (not in the Web project). So it doesn't get copied on bin folder (I guess that's the correct behaviour?). Tried changing isolation/interop settings but I'm not sure if those are related to the issue at hand.
I read things about Registering COM objects into GAC and Marshalling for Remote Access but I couldn't grasp how to apply these properly. Thing is, the official documentation doesn't say anything about this. And there isn't a single example for using b-Pac library on a modern C# ASP.NET setting (only a little on VB ~eww~).
I'm a developer, not a DBA so I'm not too confident with tweaking the server's settings. But for this issue alone, I modified too many things too many times.
So, the problem was about the app id permissions all along. I changed the Application Pool's identity to LocalSystem and now it works as expected.
Still, I'm not sure what kind of security flaws this change would cause in the future. I posted this link to the vendor's technical staff. But they didn't give me an answer yet.

Response.Redirect() Works in Visual Studio but not IIS

I'm trying to upload a basic web application from visual studio on Windows 7 to an IIS environment on Windows Server 2007.
Though launching it from IIS displays the Login page, trying to navigate past it to the main menu returns this error:
Server Error in Application "PARKING/PARKING ASSIGNMENTS WEB"Internet Information Services 7.0
Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:81/Parking Assignments Web/Home
Physical Path C:\ParkingAssignmentsWeb\Home
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
•The directory or file specified does not exist on the Web server.
•The URL contains a typographical error.
•A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
•Create the content on the Web server.
•Review the browser URL.
•Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Links and More InformationThis error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
View more information »
This is the code I used for navigation:
Response.Redirect("Home.aspx");
Why would this navigation work on Visual Studio but not on IIS?
UPDATE: I tried the variations of the Redirect command you guys showed me but all of them gave a 404 error, which leads me to believe that the problem isn't with the command but with something else. Any idea what?
It treats Home.aspx as a relative path.
Use it like:
Response.Redirect("/Home.aspx");
when you deploy to IIS a different web server is being used. Visual studio uses a web server with limited options and in most cases but not all an application should run without changes when deployed to IIS on windows server.
Things to check
Verify that the folder structure on your workstation looks the same as the folder structure deployed to the server.
check permissions on the folders accessed by IIS on the web server
Response.Redirect("Home.aspx"); assumes that the file is in the same directory as the page that is invoking the transfer
add a more complete path either ("/home.aspx") or ("/folder/home.aspx") where folder is the actual folder name that contains the .aspx file
Please try:
Response.Redirect("~/Parking Assignments Web/Home.aspx");
or
Response.Redirect("~/Parking Assignments Web/Home");

WCF calls 3rd party DLL only works in VS2015 but not without

I am using 64bit Windows7 home premium SP1 and VS2015.
I wrote a WCF application which calls a 3rd party dll (from vendor) written in C#. When i "view in browser" by right clicking ProductREADService.svc in VS2015 solution explorer, I can call the svc(localhost:17476/ProductRESTService.svc) and method(this calls the 3rd party dll localhost:17476/ProductRESTService.svc/getproductlist/1) and the WCF works without any problem on the browser (chrome and IE), returning xml result correctly.
Now I want this WCF to running without VS2015 since I need it to run in production env.
Problem:
1)
However, when I publish this WCF to IIS7.5, I was able to call the svc (localhost:8123/ProductRESTService.svc) without problem, but when I called the method (localhost:8123/ProductRESTService.svc/getproductlist/1) I encountered request error "The server encountered an error processing the request. See server logs for more details."
When I checked the logs I found this:
2016-09-07 12:46:44 ::1 GET /favicon.ico - 8123 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/52.0.2743.116+Safari/537.36 404 0 2 3
2016-09-07 12:48:26 ::1 GET /ProductRESTService.svc/getproductlist/1 - 8123 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/52.0.2743.116+Safari/537.36 400 0 0 4
I tried changing the DefaultAppPool identity to LocalService and my windows login ID, nothing works.
In order to confirm the problem lies with the 3rd party DLL, I changed the method getproductlist not to load/call the 3rd party DLL but instead return fixed dummy value, and now both works perfectly. So I am sure the problem is caused by the DLL when running without VS2015.
2) I reverted back the code and stopped IIS and tried running IISExpress (using the IISexpress used by vs2015). I started it using the same config file as VS2015 inside /config:path-to-code.vs\config\applicationhost.config... I encountered the exactly same issue, while accessing localhost:17476/ProductRESTService.svc there is not problem.. BUT encountered error when accessing the method localhost:17476/ProductRESTService.svc/getproductlist/1.
Question:
q1) how come the WCF calling 3rd party DLL only works when launched using VS2015 and not when launched via IIS7.5 or IISexpress independently?
q2) how to copy the IISexpress settings/config from VS2015 into IIS7.5 and to the c:\program files\IIE Express\IISexpress.exe?
Any help will be appreciated. Thanks!
Update:
2) I found the problem for IISExpress.. I changed to "C:\Program Files (x86)\IIS Express\iisexpress.exe" instead of "C:\Program Files\" and both svc and method work! Why not "C:\Program Files" since my OS is 64bit?
I still cant get IIS to work for both, any help would be appreciated!
Thanks!
Update Solved!
I managed to fix the problem. In IIS 7.5.76 I set the DefaultAppPool advanced settings to
1) .NET Framework Version v4.0
2) Enable 32-bit application = true
3) Identity = LocalSystem
Now, my WCF service and method(calling 3rd party DLL) works with IIS and I can run it as a production service!

ASP.NET project not building in my Testing machine

I have a running project that I need to modify. I am trying to load the whole project into my Visual Studio 15 CE for modifying. I have got the whole list of files in my Solution explorer and then also the database in SQL manager. When I click execute, it gives an error list! Here is the image. enter image description here
Then In the Browser, I get this message:
HTTP Error 500.24 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
system.web/identity#impersonate is set to true.
Things you can try:
If the application supports it, disable client impersonation.
If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation#validateIntegratedModeConfiguration to false.
Detailed Error Information:
Module ConfigurationValidationModule
Notification BeginRequest
Handler StaticFile
Error Code 0x80070032
Requested URL http://localhost:55014 /fanKc9TuE6zuHQVMTPwHWVIHJCM.html
Physical Path H:\Quoting system files\MGF_LIVE_BACKUP\fanKc9TuE6zuHQVMTPwHWVIHJCM.html
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory D:\Old folders\Documents\IISExpress \TraceLogFiles\MGF_LIVE_BACKUP
This is an application Pool setting issue..
Try going into IIS and changing the app pool for your application to use classic mode instead of integreted mode.
Alternatively you can add this to your Web.Config:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>

Not able to load MicrosoftAjax.debug.js

I have an ASP.NET 3.5 web application which works perfectly fine on my local machine and when I deploy it on my Windows 2008 server. I am getting the following javascript error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0
URI: http://localhost/ScriptResource.axd?d=e1Gld4LGHLsC4rWqevEI8zAMJKoVcCEVHBjdJIxcQLO9of6t7nNopbI1YyxJTv1QbaxN_lTSoz5Ly-VjBRHp08Mf3xxg5V9i5Z0AiXIkZRY1&t=6af1de90
I have a utility which can decrypt the URI and tell exactly what file is missing and it tunrns out that the file is ZSystem.Web.Extensions,3.5.0.0,,31bf3856ad364e35|MicrosoftAjax.debug.js|. Why am I not able to load this js file? Any help?
Possible options:
You've not installed .NET Framework SP1 on your server, so it can't find the 3.5 assemblies to generate the MsAjax file.
You've deployed your web.config file with <compilation debug="true"> while IIS has been configured to compile it in release mode.
I have run into a similar problem before when the development and production machines are set for two different time zones. When ASP.NET AJAX tries to load a script resource from an assembly, the last modified date/time of the assembly is validated. If the local time of the production server is "earlier" than the last modified date/time of the assembly, then an ArgumentOutOfRange exception is generated by ASP.NET AJAX when processing the request.
Really difficult to debug since the problem eventually resolves itself.
I suppose this might be possible with a System assembly if Copy-Local is set to true.
I was using some third party web services and the problem was with the following xml tag in the web.config:
<extendedProtectionPolicy policyEnforcement="Never" />
Once I removed this tag the error went away

Categories

Resources