"There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined" - c#

I am developing a project using vstudio 2015, when i tried to run it on another system i am getting following error, tried many solutions available here but unable to get rid of this.
Note: another systems has same configurations as of mine.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\D:\Visualstudio Projects\SPARC\SPARC\web.config
Requested URL http://localhost:1396/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory C:\Users\Syeds\Documents\IISExpress\TraceLogFiles\
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
Warm welcome for suggestion and answers,
Thanks & Regards.

Restarting visual studio might help on this.
This usually happens when you have invalid configs in your {solutions_dir}/.vs/{project_name}/config/applicationhost.config. This file contains machine specific configuration.
.vs/* directory should be added to your gitignore if you are using git. So the contents of this directory never gets pushed to the main repo.
If this will not work.
Open the file {solutions_dir}/.vs/{project_name}/config/applicationhost.config.
Go to the sites section
Check the application if it matches the physical path that is configured for each site applications. IISExpress will look use the phyiscalPath as its based directory per application.

In my case Actual issue was directory, to solve it what i did was creating same folder directory (as in my system) into other system.
IIS was trying to find webconfig in D:\Visualstudio Projects\SPARC\SPARC\
So, i created folder "Visualstudio Projects" in D: and then pasted the project there and it worked..
There was no any problem in web.config or applicationhost.config or in any of the IIS configuration.

I have this issue when I have same project file (Solution file) in two separate folder. The project properties was same and port number for IIS Express was same. The issue is resolved when I created new virtual directory.
Change project URL in Project>Properties>Web>Servers>Project Url.
Please create new Virtual Directory.

Try open your web.config and search for a tag named <scriptResourceHandler>
Can you find more than 1 result?
If yes, try merging the two "scriptResourceHandler" to one.

Related

Config File referencing wrong location .Net application

I am inheriting a .NET application. For starters I have copied the source to my machine and opened the solution with Visual Studio. Upon running the project I see the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \\?\path\not\on\my\machine\web.config
The problem seems to be that the path referred to by "Config File" is not the path to the file on my machine. The path seems to be from an IIS server on which the app was deployed.
I've seen others with similar problems, but in my search I have been unable to find this reference so that I may update it.
Visual Studio (2015) itself seems to respond to changes I make in web.config, particularly when I change this <compilation debug="true" targetFramework="4.0"> from true to false.
How can I change my project set up to allow the application to run on my machine?
I was able to fix the problem. Under the project directory there was a file .vs\config\applicationhost.config. From there I changed the physicalPath attribute on the virtualdirectory tag that referenced the wrong place.

Opening webapi project giving an error

I am getting
"Creation of virtual directory http://localhost:30852/ failed with the error: Filename: redirection.config Error: cannot read configuration file"
while opening webapi project. Someone else created on their machine and I am downloading from TFS. It works fine on their machine.
I have installed latest .net framework and I have IIS installed on my local machine.
I already tried opening Visual Studio as admin, but no use.
There could be a couple of things gone wrong here.
1) I've seen the problem occurs that TFS ignores an item from checking in or completely removes them from the being part of source control.
If this is the case, let your college re-add then to the source control and commit.
2) check on your college's machine. If the file is actually marked as part of the commit and if it's committed. If both seem fine, make sure the version on your local repo is correctly pulled from TFS.
Depending on what version control (git or TFS) you are using your files are by default located at: C:\Users\%username%\Source
3) There is a difference in the redirection config you and your college are using. You might already have the other application registered at this path in your application host config.
The config can be found at Documents\IISExpress\config simply compare this config with your colleges. If you have a conflicting configuration you can change it to a different port.
As last resort, you could simply copy over the redirect config from your college and see if this fixes the problem.

Unable to access project on IIS after adding to a VS solution containing other projects

I added a new project ABC in the existing solution and trying to access that using localhost/ABC on the local IIS . Since none of the other projects have created virtual directories or converted it into application . What could be the way around for this error
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
To do what you are after you need to go to the web tab on the project properties in visual studio. This allows you to either use IIS or the Visual Studio development server.
You can specify the URL to access the projects and specific ports if you are using the local IIS.

EntityFramework.dll failed to copy to web server using FileZilla

while hosting .NET MVC Web Project in somee.com, i get below error in FileZilla Client, i am trying to copy EntityFramework.dll and EntityFramework.xml files to my project bin folder in web server, hosting first time , Any advise would be greatly appreciated.
Thank You.
Error Shown in File Zilla Client :
Command: STOR EntityFramework.dll
Response: 550 The process cannot access the file because it is being
used by another process.
Error: Critical file transfer error
Status: Disconnected from server
Command: STOR EntityFramework.xml
Response: 550 The process cannot access the file because it is being
used by another process.
Error: Critical file transfer error
Looks like your solution is working when you're trying to copy the assemblies. Stop your server and then copy the dlls as they are used by the application
Surprisingly enough, the file is in use and cannot be copied.
The IIS process is likely using the file to access database resources or running website queries. As such you need to shut-down IIS temporarily to copy the file. Once the copy is successful, you can then start IIS back again.
This assumes that the file needs to be copied. If the file is the same, and not changed in any way, you can ignore the error as a copy is not needed.
finally arrived to solution, i tried stop IIS from command prompt, but this Installing IIS on Windows 7 Home Basic research proved that windows 7 home basic doesn't allow install of full-fledged IIS,
Then even if i try to install the IIS from Turn Windows Features on Off, i get this error : " Not all of the features were successfully changed " so i unchecked IIS, Internet Information Services Hostable Web Core and Windows Process Activation Service then restarted the machine,
At Last Instead of using FileZilla to Transfer the Dll and Xml files, i came across Windows Publishing Wizard, located in Program Files/Web Publish. provided the host name etc, dll was successful transferred but xml file gave the same error again, so as i read in some asp.net forums, i removed the referenced EntityFramework.dll from closed project, using project properties --> References --> Unused References , then XML file was also done.
I provided whole details because it may help someone there.
Thank you, #Vsevolod and #Kami.
Thank you all.

"..allowDefinition='MachineToApplication' beyond application level" error on deploying the website on web host

I came across the solution of this genetic problem all across the internet and Stackoverflow, but none of them talk about the same after/on deployment. I also read this famous article . So, my website runs absolutely fine via VS 2010. However, I get this problem the moment I deploy my website using the copy tool of VS 2010.
There are three web.config files in. 1- root, 2- Users folder, 3- accounts folder. The tag exists in the web.config file in the root. The hierarchy of which looks like: domain.com / httpdocs / websitefolder / web.config. In the websitefolder there are Accounts and Users folders which further contain web.configs, but non of them have the tag.
What could possibly go wrong from the development machine to deployment? The error I am getting is on line:
Line 16: <authentication mode="Forms">
In the httpdocs, there are other projects with web.configs, can that be a problem? In that case, I also deleted their contents, but didn't help (but may be I should have done a better job? I don't know if this is what was required at all?).
Also, this is a website, so there's no bin or obj folder being created, none of that kind of issue. Please suggest, I am not able to figure out the problem. Thanks a lot.
Usually when you have multiple sites in sub directories of one site, inspite you delete a web.config, the problem will persist. In that case even the sub folders should be marked as an application.
Is the folder in which you have this website deployed an application in IIS? It is one main reason why this error could occur.
If its not, make it as an application and the problem should resolve.
Update: Seems you have used File System while developing your website.
Firstly install IIS server like "this".
Next you should create a virtual directory in IIS. See "this" . (in physical path, select the path upto your deployment folder)
Now run the website. If your problem is solved it means the issue is with the virtual directory in your remote server. So report them.

Categories