Opening webapi project giving an error - c#

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.

Related

ClickOnce not replacing App_Data files during re-install

I noticed a behavior I don't understand happening with my application's ClickOnce deployment: a database file (Main.accdb) that is marked as a data file isn't replaced in C:\Users\username\AppData\Roaming\AppName after re-installing or installing a newer version.
In the Project Properties > Publish > Application Files I have:
File Name App_Data\Main.accdb
Publish Status = Data File
Download Group = (Required)
Hash = Include
In the file properties I have:
Build Action = Content
Copy to Output Directory = Copy always
When I install my WPF application using ClickOnce the first time, the file is found in C:\Users\username\AppData\Roaming\AppName. However, if I uninstall, delete the file in that folder, and re-install it is not replaced. In fact, anything removed from that folder isn't replaced by re-installation.
I tried various options for the Publish Status but the same behavior happens regardless of which options I choose. I'm using WPF with C# in Visual Studio 2017.
Why is this happening and how can I make it so that the file is always there when the application installs (or even better, launches)?
It turns out that the App_Data folder behaves differently and the issue can be resolved by using a folder with any name except App_Data.
I can't find this documented anywhere except for a handful of forum posts of users with similar issues, however, I was able to verify that it all works exactly as expected once I changed the folder name.
All that being said, Microsoft does seem to want developers to use App_Data for databases, so perhaps this is an exception to the norm and may not be the right approach for most projects. In my case, it's a desktop application that needs to deploy a local Access database to the user's computer on install and keep it up to date/replaced during re-install and updates.

Getting error message unknown server tag 'dnn:ComboBox' when setting staging from production

I have copied files and database from production environment and copied to staging server, when I browsed on staging environment then getting this error message.
This most likely occurs because you're missing the referenced assemblies on the server. The DotNetNuke libraries appear to be missing.
You need to add the relevant references as CopyLocal and then redeploy.
It's a good idea to ensure that your environments are as near-identical as possible, and that if referencing third-party libraries, you're either:
Installing the libraries in the GAC across all environments and referencing from the GAC
Using copy-local references and deploying the assemblies with your code
Using something like Nuget and having your CI system resolve them prior to deployment.
Try comparing your development web.config file with staging. I guess you have a tagprefix (e.g. < add tagprefix="dnn".. />) in your development config file (under system.web -> pages -> controls) but not in staging.
This appears to be an incomplete backup/restore. Please start over. Be sure to copy all files. If they're coming from a Zip file, be sure to "unblock" the Zip file in its properties.
A good backup restore will have the following:
All files from the original location (sometimes in a zip file).
Full backup of the database.
A good restore requires the following:
Domain name to respond to.
A folder with the full file system backup copied into it.
The folder will require permissions to load all files (e.g., IIS_IUSRS and Network Service).
Full restore of the database to an accessible (local?) database with a unique user assigned to it as db_owner.
Updated web.config to reflect the new database location and user credentials (usually requires at least 1-2 updates).
Update the PortalAlias and PortalSettings tables to correctly reflect the website domain name to respond to (e.g., localhost.mysite instead of productiondomain.com).
As long as there are no typos or missed steps, this works every time.
Optional additional things that we usually do include:
Scanning for viruses.
Scanning for unexpected files (e.g., *.asp and *.php).
Updating the HostSettings to reflect a new (local SMTP) server.
Cleansing the restored database of PII.

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

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.

Azure Web Deploy publishing old version of MVC sites .dll

I deploy my MVC site via a web publish within VS 2013 to an Azure location. I have published many times without issue from the same machine and IP address, but yesterday it stopped working.
The publish is placing an old version of my projects .dll in the bin folder on the site. This version no longer exists on my machine, it isn't the projects current Git state (and has never been the current Git state) and is not the version in my Release, Debug or Demo compiled folder. I don't know where it's coming from.
So when I publish, I get errors relating to the database changes because the model behind my context has changed since this old version.
So currently when I publish I have to FTP into my site and replace the WebPortal.dll file with the one in my machines bin folder, and the the site works fine.
What could be causing it to revert to this old .dll and where is it coming from? Have I somehow excluded my changes past a certain point from the publish?
Note - My views are publishing absolutely fine, it is just the .dll that should contain the current compilation of Models, Controllers etc., but instead contains an old version missing loads of stuff.
JK
There might be an old version of your dll on the server that is not being overwritten during publish. Have you tried checking "Remove additional files at destination" the the settings section of the Publish dialog. That should remove all the files from your target location except the one you publish.
If you are still having a problem after that try publishing to your local file system so you can see exactly what publish is sending to your server.
Update:
Steps to publish web application to file system.
right click on your project in the solution explorer menu and select Publish.
In the profile section of the Publish Web menu select Custom publish type, click next.
Select file system in the Publish method drop-down. You should see the target location text box where you can specify your folder.
Continue with the rest of the publish steps with you usual settings and click publish.
Double check that your Build (Menu) > Configuration Manager > Build Configuration for Release has the tick next to Build for the WebPortal.DLL. If it isn't set to build then it would use an older version.
I had the same problem. Goodness knows where the old dll is coming from but in the end I up-versioned the library to a higher number and it seemed to cure it. I suspect the GAC or temporary files might be part of the problem although I can't find my library there.

HTTP error 500.19 - Cannot read configuration file

In one of my ASP.NET apps, all of a sudden I am unable to run it in Visual Studio 2013 due to the error displayed below. It appears that it is trying to open the web.config from a path that doesn't even exist. All of my project code, including web.config, are located under C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web. I've found a number of posts here from users experiencing a similar error, but the solutions seem to vary and none I've found so far seem applicable to my situation. I looked in that TraceLogFiles directory and the most recent log file there is five days old so it obviously hasn't been logging anything since I've been having this issue. Any suggestions are appreciated.
In my case I deleted all folders in D:\My Documents\My Web Sites\ before
Then I caught the error
There is a file .vs\config\applicationhost.config in my solution folder
It contains reference to the deleted folder. So, I deleted applicationhost.config and then pressed 'Create Virtual Directory' button in my project property Web page. It was recreated the file and the folder
I've been able to resolve this issue even though I can't say I fully understand all of the details. I'll attempt to describe the situation the best I understand it and hopefully others with greater insight can add further clarification.
After having been doing all of my development on my workstation, it was suggested that I begin doing this work in a new VM environment that had been set up for me. So I installed VS 2013 there and copied my source code from various projects over there. However, rather than follow my previous local path convention of C:\Projects\SourceCode[ProjectName]... this time I decided to use the directories that are set up during the VS install, c:\users[MyUser]\My Documents\Visual Studio 2013\Projects[ProjectName]. Sometime shortly thereafter, our infrastructure team made a change so that my home directory, c:\users\rmayer, was now being pointed to a common network drive, \totalsafety\TSUsers\rmayer. Everything continued to work without any issues.
However, due to various difficulties I had working in this VM environment, I decided to return to doing my development work on my workstation using the original local paths for my source code. This is when I began encountering the errors described above whenever I would try to run my code through VS. What I've begun to learn is that there is an applicationhost.config file that IIS Express uses located here: \totalsafety\TSUsers\rmayer\My Documents\IISExpress\config. It contains entries for each of my web projects; the one relevant to this issue had a section which looked like this:
<site name="AFEManager.Web-Site" id="8">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\rmayer\Documents\My Web Sites\AFEManager.Web-Site" />
</application>
<application path="/AFEManager" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:19257:localhost" />
</bindings>
</site>
The physical path attribute listed under applicationPool="Clr4IntegratedAppPool" at that time was set based on the local path I had been using at the time I was working in the VM environment. Now that this one file is being shared regardless of whether I'm working locally or within the VM due to the move of the users' home directories, this path is invalid when I'm working from my workstation. By updating this path to C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web, it now works correctly from my workstation.
Again, I have a limited understanding of how this is supposed to work, but what it's telling me is that I will be unable to do development work from multiple environments (not that I want to any longer) unless the local paths are consistent between all of them. If I'm correct about this, this seems like a less than ideal design.
I had this issue when I moved the project folder to the new machine. The problem is that the VS has the site registered in its config file (applicationhost.config) inside .vs/ folder but did not create folder inside %USERPROFILE%\My Documents\My Web Sites\. If you just click Create Virtual Directory inside the project properties (Web tab) it will not be enough.
First close your VS and remove .vs/ folder inside your solution directory
Reopen VS and click Create Virtual Directory inside the project properties (Web tab) - VS will register the site again and create corresponding folder inside %USERPROFILE%\My Documents\My Web Sites\
I changed the virtual directory path in vs\config\applicationhost.config inside the solution folder.
In my case, the project was located on network not my local disk. After copying the project to local, the issue was resolved. Hope it can save someones time who has the same issue.
You can change the path for the web.config to its real path in applicationhost.config file. This file is located in /.vs/config folder.
After changing the path in this file, save it and restart the project, it solved my issue.
This is happening because I have different work stations, but the project is saving in different folders.
Delete .VS folders that Visual studio created.
It might be hidden in your project structure.
Unhide the folders and look for .vs folder and delete that folder and rebuild the application.
Most simplest way to solve this issue.
Approximate reason to arise this error is copy project from another pc.
Solution:
Step 01: From Visual Studio Solution Explorer, Right click on your project and choose Open Folder in File Explorer.
Step 02: Open .vs folder (Hidden Folder) and
you will get 2 folder named config and another one is named as
your_project_name/config.
Step 03: Both config folder will contain a
file named applicationhost.
Step 04: Open both applicationhost file using notepad and find the directory showing in error screen (Config
File \?\C:\User\hp\Documents\My Web
Sites\YourProjectName\web.config)
Step 05: Just replace this
directory according to your pc directory. Example, in my pc I have
changed as below:
C:\Users\Sydur Rahman\Documents\My Web Sites\MyProjectName-Site
to
C:\Users\hp\Documents\My Web Sites\MyProjectName-Site
Note: Please make sure you have changed in both applicationhost file.
That's all. Now your project will run as expected!
Thank you PongGod!! I am not able to comment on your answer but I wanted to post anyway since I had the exact same issue while running an instance of Orchard. In my case, everything had been running great until I found a bunch of old project files located in:
%USERPROFILE%\My Documents\My Web Sites\
And started deleting them for no apparent reason. I then tried to start up Orchard from Visual Studio in debug mode and received the error message above. After applying the same fix to my applicationhost.config file, everything is working fine now.
In my case, I am assuming that the directories got mixed up because I had initially ran the default Orchard files from Visual Studio and from Web Matrix. Then later on, I downloaded the full source files and began running the files from a completely different directory. Thanks again.
Here is a solution i have found.
https://gyorgybalassy.wordpress.com/2015/03/06/i-asked-for-a-vs-folder-and-the-vs-team-gave-it-to-me/
(1)Find the applicationhost.config file in |YourSolution|\.vs\config
(2)Modify the VirtualDirectory PhysicalPath To your project.
(3)Restart solution. Start project.
(4)If it's still not working, try to check setting in your IISExpress config. If there is not site setting, copy And paste the setting to |UserOnYourComputer|\Documents\IISExpress\config\applicationhost.config
(5)Change the id to other id which not be used in IISExpress applicationhost.config.
(6)Start your project.
I experienced the same issue and I resolve it quite simply. My issue was arose after when I perform a merge operation in git repository, after merge operation Visual Studio some how changed my default project URL to the default URL of my partner's computer from where he pushed the last time in to my repository.
So here is how I resolved this error:
Simply go to the properties of the project.
From the left vertically aligned menu, select Web.
After you will Project url and a text box containing the default port number, now just aside that textbox there is a button "Create Virtual Directory".
Press that button and there you go.
It will again point the default url the current working folder of your project.
Hope it works for you all :)
After all this answers I find my solution. Delete te WebSite in the IIS and recriate. Why? Because I had create de website before installed the framework 4.5 and URL Rewrite.
Go to the project dir:
..\\{ProjectDir}\\.vs\\{ProjectName}\\config
Then delete the applicationhost.config file and recompile your solution.
That's all.
This steps helped me to get over this error
1.In Windows Explorer, locate the web.config file that is associated with the Web site.
2.Right-click the web.config file
3.Click Properties.
4.Click the Security tab, and then click Edit.
5.Click Add.
6.In the Enter the object names to select box, type computername\IIS_IUSRS, click Check Names, and then click OK.
Note* Computername is a placeholder for the computer name.
7.Click to select the Read check box, and then click OK.
8.In the Web.config Properties dialog box, click OK.

Categories