Error 1 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. C:\Users\rzv\Desktop\WebSamples\Backup\WebSamples\Web.config 49
when I try to run http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx in VS 2010. What's wrong and why do I get IIS error when I run something in VS?
Edit
When you convert a project from VS 2008 to VS 2010, it creates a folder /backup/ inside of the application. When you run the project, it is trying to run the project and the subfolder /backup/, which contains a web.config file. Move the /backup/ folder to another location and it should work.
In general, you can't run an application from a subfolder of another application if it uses application-level settings in its configuration file web.config.
Related
In my C# WPF application I need to access some configuration files via a 3rd party library. This library requires to have the configuration file located in the same folder as the executable of my application. So i have no chance to change this behaviour.
While running my application in Visual Studio 2013 it works fine. I can access the configuration file since I have just copied it to the relevant folder.
But if I install my application an run it it cant locate my configuration files because it tries to find it under: Windows\system32.
No my approach is to make it happen that my application looks for the configuration file in the applications install folder.
How can I do that? How can I set the current\working directory of my application to a specific (installation) path in Visual Studio 2013?
try this
string path = AppDomain.CurrentDomain.BaseDirectory.ToString();
This will give path like "c:\\program...\\installdir\\" where your .exe is located.
I'm trying out ASP.NET 5 and all its new features on VS 2015 Enterprise RC. To ensure smooth end-to-end deployment, I then try to deploy the application to a non-Azure private server through VS Publish feature.
However, I'm missing out a very important feature: the ability to publish to a non-Azure server.
In earlier versions of Visual Studio (I'm using VS 2013), the Custom options is there.
I've tried tinkering with the Project Properties but nothing on how to deploy my ASP.NET 5 app to a custom server. Any ideas?
It's doable (after all, publishing to Azure websites also uses WebDeploy internally), but it's kinda tricky right now and requires you to tweak a few things.
Here's what you can do (for VS 2015 CTP6):
Preparation
Asp.net vnext has slightly different directory structure than a regular Asp.net app. The are two main directories: approot and wwwroot (if you deploy the application to local filesystem, you can browse through them). We want to deploy both those dirs, but the IIS website path has to point to wwwroot dir. This problem seems to be addressed in Web Deploy 3.6, but i will just deal with it manually. In order for this to work, you can create two websites/applications in IIS:
one that points to the root application dir and will be used just for deployment. I will name it mysite-deploy.
one that will be used to actually host our website and will point to wwwroot dir. I will name it simply mysite.
Deployment
Go to YourprojectDir\Properties\PublishProfiles
Create an empty pubxml file (i.e. mysite.pubxml)
Paste the following content into your pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
</PropertyGroup>
</Project>
When You press "Publish" in Visual Studio, you should see this new profile on the list.
Fill out the Connection tab, as you would normally do (set Server, Site Name, etc.). Remember to set Site Name to the deployment site (mysite-deploy).
Validate Connection
Try the preview tab - it most probably wouldn't work, but in case it does - you're done.
Click Publish
Check progress in the Web Publish Activity window.
Possible errors
Out of the box, the publish will probably fail. Now it gets tricky :)
ERROR_FAILED_TO_DESERIALIZE
At first, what I've got is this error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.AspNet.Publishing.targets(205,5): Error ERROR_FAILED_TO_DESERIALIZE: Web deployment task failed. ()
Publish failed to deploy.
Let's try to fix that.
Open the Publish window again, and check Publish using Powershell script option on the Settings tab.
Try again.
ERROR_CERTIFICATE_VALIDATION_FAILED
If you get an error: ERROR_CERTIFICATE_VALIDATION_FAILED, this means that the SSL certificate that IIS Management Service on your target machine is not trusted by your computer. You can try to download the certificate add it to trusted cert store, or you can disable certificate validation altogether.
In the latter case, you need to edit publish-module.psm1 located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\1.0.0-pre\publish-module.psm1. Find the fragment:
# add excludes
$sharedArgs.ExtraArgs += (GetInternal-ExcludeFilesArg -publishProperties $publishProperties)
# add replacements
$sharedArgs.ExtraArgs += (GetInternal-ReplacementsMSDeployArgs -publishProperties $publishProperties)
And add this:
$sharedArgs.ExtraArgs += '-allowUntrusted'
ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
Inspect the exact commandline that is getting invoked - in Web Publish Activity Window there should be a line logged, starting with Calling msdeploy with the command:. Look for ComputerName=. If it looks like this: ComputerName='https://https://myhost:8172/msdeploy.axd'/msdeploy.axd', then you should changeServerfield in Publish profileConnectiontab to:myhost:8172. That's because the powershell script automatically addshttps://and/msdeploy.axd`.
ERROR_PROVIDER_NOT_FOUND
More Information: The provider 'contentPathLib' could not be found. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_PROVIDER_NOT_FOUND.
Go again to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\1.0.0-pre\publish-module.psm1 and find the line:
$publishArgs += '-enableLink:contentLibExtension'
This seems to be a feature of Web Deploy 3.6, but it seems that the server side has to support it also. To disable it, just comment out this line. Warning: This change may impact powershell deployment to Azure websites.
Only the content of wwwroot directory gets deployed
Now that your site is being deployed, there is one more thing. We wanted to deploy approot and wwwroot directory, and instead only the content of the wwwroot directory is deployed. To fix that, we need to once again edit C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\1.0.0-pre\publish-module.psm1.
Find the line that says:
$webrootOutputFolder = (get-item (Join-Path $packOutput $webroot)).FullName
And after that, add a new line:
$webrootOutputFolder = $webrootOutputFolder | split-path -parent
This will set the published folder to the parent of wwwroot, which is exactly what we need. Before publishing again, you may want to clear your site's directory on the server - the published directory structure will be different now.
Testing
At this point, the site should be deployed and available on the server. On the server side, you should see two directories: approot and wwwroot and maybe some script files.
Any server side errors you will have to debug yourself.
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.
I got a error:
Error 1 Cannot copy assembly 'ICSharpCode.SharpZipLib.dll' to file 'FileLocation\bin\ICSharpCode.SharpZipLib.dll'.
Unable to add 'FileLocation\bin\ICSharpCode.SharpZipLib.dll' to the Web site.
Unable to add file 'bin\ICSharpCode.SharpZipLib.dll'.
The process cannot access the file because it is being used by another process.
Any idea about this?
This is an error you can get when you have a file that's still locked by a process; it sounds like the file was still open by something when you went to build,so it couldn't copy it to the website.
As long as you aren't directly modifying the ICSharpCode.SharpZipLib source code, and since it's reporting it to already be in the location you need, it's possible that the development or IIS server just still had the file open, in which case it wouldn't be a big deal. (Did you close all browsers?) If that's the case, and your application is running fine, then it's probably not a huge deal, although I would probably close down the development server, and Visual Studio, then reopen and try again. (If running on IIS, try restarting the website.)
If you start having issues with whatever part of your code uses the Zip functionality, then you will need to investigate further.
Sounds like your app was recompiling and tried to copy the zip lib, which was already in use because of a bad ref in visual studio or a running program. When does this occur? Please provide more details. Close out visual studio (if its running). If its a web app, restart IIS and try doing whatever unknown action you were doing again.
Application tried to copied ICSharpCode.SharpZipLib.dll file from GAC or Visual Studio Assembly folder into your application's bin folder but it can't copied and application runs successfully on your system because your application put this dll file from GAC. But whenever you will run this application any another system on which Visual Studio not installed, on that machine it couldn't runs properly....
We are trying to add a new page to a running web application. such that a new dll and aspx file are being added. I've setup break points in the code file and Built the application transfering the dll to the remote machine bin file and the aspx page to a folder within the web application. Note this folder is not in the same folder hierarchy as it built in. I'm not sure if thats the problem. Basically we are appending new functionality to a web application.
I've completed the following
I've copied the correct Remote Debug Monitor to the server and have it running.
I'm able to attach to the process which in this case is w3wp.exe (I've Identified that it is the correct process for my application.
I deployed the *.dll to the the bin folder with the *.pdb file along with it.
I've deployed the *.aspx file to the location we want.
With the file open in visual studio with breakpoints setup, we attach to the process and debug. I get 'No symbols loaded' and the breakpoint go empty.
I'm missing something it seems. I've searched the net but have only found complete publish\ deployment scenario.
Any thoughts
Tools -> Options -> Symbols -> Add the path to your deployed web application dlls and pdbs.
You might also need to uncheck "Enable Just My Code" under general debugging.
Here's a more detailed answer that got it working for me in the past: Remote Debugging is not breaking on errors