IIS 7.5 website reads wrong web.config - iis

I have 2 projects running on my IIS under Default Website, project A & B. They have two different physical paths.
When i try to run project A i get this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Source Error:
Line 27: <pages>
Line 28: <namespaces>
Line 29: <add namespace="System.Web.Helpers" />
Line 30: <add namespace="System.Web.Mvc" />
Line 31: <add namespace="System.Web.Mvc.Ajax" />
Source File: c:\inetpub\wwwroot\B\EnrollmentPortal\Web.config Line: 29
Project A tries to read the web.config of project B. How is this possible? I can't find any path from project A to project B, and no setting in IIS where you can specify a path to web.config.
How can i solve this?

Related

IIS V10.0 in Windows 10 does not recognise anymore customErrors on web.config with 500.19 0x80070032 error

I use IIS 10 on windows 10, I was use to have web.config files with customErrors, but now it is not accepting it anymore. I been procrastinating hotfixing just removing the line from the webconfig, but now I am trying to figure out what is wrong and fix it once and for all.
Error Source:
<system.web>
<customErrors mode="Off"/>
<httpRuntime targetFramework="4.6.2" />
The machine config has <deployment retail="true" />, and whit this configuration if I remove the tag IIS works fine and the web application is served correctly, if I change the retail setting to false, it will break again asking for the customErrors to be set.
I could not find any information online on this specific type of issue, and I tried to follow also the error code investigation path, but it leads to TLS configuration which in my case is correct and enabled.
After lots of digging I found that one of the machine.config (for the current framework4x and architecture x64) had a missing section in the system.web group:
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
I copied the section from the 32 bit version of the machine.config and this fixed the issue.
This documentation about IIS configuration hierarchy helped me:
https://learn.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/the-configuration-system-in-iis-7#:~:text=%20At%20the%20root%20%28or%20global%29%20level%2C%20there,global%20defaults%20for%20the%20.NET%20framework...%20More%20

azure deployment: no package.json file in site/wwwroot

When I try to open my Azure NodeJS React web app in Chrome, I get the following error:
PATH="$PATH:/home/site/wwwroot" npm start
ENOENT: no such file or directory, open '/home/site/wwwroot/package.json
This checks out when I examine the contents of /site/wwwroot in the Azure SSH:
_del_node_modules
asset-manifest.json
b
favicon.ico
index.html
logo192.png
logo512.png
manifest.json
oryx-appinsightsloader.js
package-lock.json
precache-manifest.6794c2e4defba13a31dcee7cae67859b.js
precache-manifest.705c77ad34ded94d21baca064fa569aa.js
precache-manifest.730dd540546e78da1c3ebb04036e733d.js
precache-manifest.9980bb9186e0ebd2771eff926887f432.js
precache-manifest.9a518a34a27fad9a357b7c78cdfbb7e8.js
precache-manifest.9c65ce33aab3813a0f162cf91b74c0f4.js
precache-manifest.ac183c8385a56a732a8286d5f2d8fa64.js
precache-manifest.b8756a719b957537ff5eb2ede103962d.js
precache-manifest.cbb7b5b3cc0bfbf94c161143ff651d3b.js
precache-manifest.e58827ccfca6115bc9268d09a7361ddd.js
robots.txt
service-worker.js
static
web.config
My build pipeline on Azure runs npm install and npm run build from the root directory, which is successful when run in VScode. The pipeline and release are successful. The outer structure of my directory tree in VScode looks like this:
├── README.md
├── node_modules
├── package-lock.json
├── package.json
├── public
├── schema.sql
├── server
└── src
So it seems like the npm run build is running successfully, creating a build folder that populates the /site/wwwroot folder. But Azure is expecting a package.json file. I tried running npm init in the public folder in VScode and also tried adding npm init to the Azure pipeline build tasks, but was getting the same error.
Also, not sure if this is related or not, but I added a web.config file in the public folder. When I look at that file in the Azure SSH, it looks like it can't be read properly:
/home/site/wwwroot/web.config: line 1: !--: No such file or directory
/home/site/wwwroot/web.config: line 2: $'\r': command not found
/home/site/wwwroot/web.config: line 3: ?xml: No such file or directory
/home/site/wwwroot/web.config: line 4: configuration: No such file or directory
/home/site/wwwroot/web.config: line 5: system.webServer: No such file or directory
/home/site/wwwroot/web.config: line 6: handlers: No such file or directory
/home/site/wwwroot/web.config: line 7: add: No such file or directory
/home/site/wwwroot/web.config: line 8: /handlers: No such file or directory
/home/site/wwwroot/web.config: line 9: rewrite: No such file or directory
/home/site/wwwroot/web.config: line 10: rules: No such file or directory
/home/site/wwwroot/web.config: line 11: rule: No such file or directory
/home/site/wwwroot/web.config: line 12: match: No such file or directory
/home/site/wwwroot/web.config: line 13: action: No such file or directory
/home/site/wwwroot/web.config: line 14: /rule: No such file or directory
/home/site/wwwroot/web.config: line 15: rule: No such file or directory
/home/site/wwwroot/web.config: line 16: match: No such file or directory
/home/site/wwwroot/web.config: line 17: conditions: No such file or directory
/home/site/wwwroot/web.config: line 18: add: No such file or directory
/home/site/wwwroot/web.config: line 19: add: No such file or directory
/home/site/wwwroot/web.config: line 20: add: No such file or directory
/home/site/wwwroot/web.config: line 21: /conditions: No such file or directory
/home/site/wwwroot/web.config: line 22: action: No such file or directory
/home/site/wwwroot/web.config: line 23: /rule: No such file or directory
/home/site/wwwroot/web.config: line 24: /rules: No such file or directory
/home/site/wwwroot/web.config: line 25: /rewrite: No such file or directory
/home/site/wwwroot/web.config: line 26: /system.webServer: No such file or directory
/home/site/wwwroot/web.config: line 27: syntax error near unexpected token `newline'
/home/site/wwwroot/web.config: line 27: `</configuration>'
Here's what it looks like in VScode:
<!-- tells azure to rewrite all urls as if they are pointing to root file-->
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="DynamicContent">
<match url="/*" />
<action type="Rewrite" url="index.js"/>
</rule>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I also encountered this problem (using windows). It was difficult to create the package.json - as it was not appearing after npm init. Preventing me from being able to install npm packages.
It helped me to:
type NUL > package.json
npm init -f
To get a actual valid package.json in place.
My problem was encountered creating a Functions App in the Azure Portal
Update:
Go to https://[yourappname].scm.azurewebsites.net/webssh/host and run npm install -g npm, and then run npm init command under home/site/wwwroot.
Original Answer:
Do you select Linux as the Web App's Operating System? I meet the similar problem on linux, but it doesn't occur on Windows OS.
In theory, there is no package.json, just use npm init to create it. I can operate smoothly on Windows OS, but not on Linux. I am investigating.

Web service giving "could not load file or assembly error"

I just moved a website and related web service from IIS6 to 8.
The website works fine, but the webservice is giving the following error:
Server Error in '/CreditCardService' Application.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The web service config file do not have any related lines in it.
Only the website web.config has any related lines in it, see below.
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Any ideas how to resolve this?

CrmSvcUtil.exe Getting Error

I am new to Dynamics CRM. iam try to generate the data context class using CrmSvcUtil.exe
this is my command
CrmSvcUtil.exe /out:E:\OrgXrm.cs
/url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:Password
/deviceid:11bdver2vrqok88p7ek8r5umk0 /devicepassword:.devicepassword
but its giving an error ;
Exiting program with exception: An error occurred when verifying security for th
e message.
Enable tracing and view the trace files for more information.
CrmSvcUtil.exe Error: 0 : Exiting program with exit code 2 due to exception : Sy
stem.ServiceModel.FaultException: An error occurred when verifying security for
the message.
Did you try specifying the port in the end of the URL?
Also Verify the Time and Date settings (including timezones) are set correctly on both the server and your client machine.  It seems that if the two machines are out of sync by more than a minute or two it will cause this problem.
Refer the below link:
http://msdn.microsoft.com/en-in/library/gg327844.aspx
To fully understand your error, you should use config file with enable tracing, here is an example of config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="servicecontextname" value="XrmServiceContext"/>
<add key="codecustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
<add key="username" value="domain\user"/>
<add key="password" value="password"/>
<add key="out" value="XrmEntitiesReference.cs" />
</appSettings>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
check out example from here:
http://www.resultondemand.nl/support/sdk/06abab26-40fc-4b85-9a2a-5e68903ea138.htm
Try it without:
/deviceid /devicepassword
Hi if you are having trouble executing your command try doing it through Visual Studio, the link below shows an excellent step-by-step guide how to use CrmSvcUtil:
http://mscrmshop.blogspot.co.uk/2012/03/how-to-use-crmsvcutil-improved-version.html

Virtual directory not able to access the in web.config of the web site - Intermittently

Intermittently, a virtual directory under the its website is unable to access the web.config. It's as if the virtual directory is not properly inheriting the web.config file from it's parent website. The issue is not reproducible all the time and when we get this issue all we need to do is recycle the app pool for the website and everything works fine.
Somewhere in the code (from the virtual directory) we are doing something like this :-
string MembershipProvierName =
(WebConfigurationManager.GetSection("system.web/membership") as MembershipSection).DefaultProvider;
and the web.config on the parent website :-
<system.web>
<membership defaultProvider="SomeProvider">
<providers>
<add name="SomeProvider" enableSearchMethods="true" enablePasswordReset="false" requiresQuestionAndAnswer="false" type="SomeRandomType" defaultUsername="aaa#bbb.com" />
</providers>
</membership>
...
</system.web>
and the exception :-
System.Web.HttpException, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Message : Source : System.Web Help link : WebEventCode : 0 ErrorCode : -2147467259 Data : System.Collections.ListDictionaryInternal TargetSite : System.String GetPhysicalPath(System.Web.VirtualPath) Stack Trace : at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath) at System.Web.CachedPathData.GetConfigPathData(String configPath) at System.Web.HttpContext.GetFilePathData() at System.Web.HttpContext.GetSection(String sectionName)
This is happening in production environment and not reproducible in any other environment. In prod also, this is quite intermittent. In prod the IIS version is most likely 6.0.3790.3959. By any chance anybody knows If this is an IIS issue?

Resources