Publishing an ASP.Net web application to a mapped drive with Visual Studio 2008 and Windows 7 - asp.net

We have a shared drive where web applications are published to. When I attempt to publish I get the following error:
------ Publish started: Project: XXX.Web, Configuration: Release Any CPU ------
Connecting to T:\WebSites\XXX\...
Unable to create the Web site 'T:\WebSites\XXX'. The path 'T:\WebSites\XXX' does not exist or you do not have access. The system cannot find the path specified.
Details
OS: Windows 7
IDE: Visual Studio 2008 (running as administrator)
Path exists? Yup.
I assume it's some permissions issue, but I have no idea where to start.

If anyone is still wondering, I had this same problem in Visual Studio 2012 with MVC4 in windows 7. I had previously published to a mapped drive and now all of a sudden it would no longer publish. In windows explorer I could see the mapped drive, but visual studio claimed it could not find the drive.
It turns out that if you are running visual studio in admin mode and your drive wasn't mapped in admin mode, you have to remap it.
(solution)
To do this, run explorer in admin mode, and then re-map your drive. Afterwards visual studio should be able to see the drive again.

I had this same problem with VS2010 and what worked for me is to click the [...] button next to the target location and rebrowse to the destination folder. Could be that VS is showing one path in the publish and output window, but really trying to access some other folder that's protected in Win7. That's why it worked in XP and not Win7 because Win7 has many more secure folders.

There are two points of check.
Share permissions.
File permissions.
You can both found on the remote computer, right click on the folder name -> permissions, and you see the Sharing and the Security tab. Change them, to left you write.
Help: how to share files:
http://www.howtogeek.com/howto/windows-7/share-files-and-printers-in-windows-7-with-homegroup/
and a video tutorial about :
http://www.youtube.com/watch?v=BWB9pu1T2dQ
Video tutorial for share folder base on my answer
http://www.youtube.com/watch?v=OomgNBAv0hI&feature=related

When you say administrator I will assume that you are an administrator to both the computer and the server containing the mapped drive. If that is the case then,
You might want to give this a shot:
To resolve this problem, add a MIME type for the .tmp file in IIS. To do so, follow these steps:
In Control Panel, open Administrative Tools, and then double-click Internet Information Services.
Expand the (local computer) node, and then expand Web Sites.
Right-click Default Web Site, and then click Properties.
In Default Web Site Properties, click the HTTP Headers Tab.
Click MIME Types. In MIME Types, click New to register a file extension.
In the Extension textbox, type .tmp . In the MIME Type textbox, type temp.
Click OK.
http://support.microsoft.com/kb/817264

If you are not in "Admin" mode and you are still having the issue, you can copy the "Target Location" path setting in your publish profile in VS, and then go to the file menu and check if you have access to that location, if you are prompted to enter user credentials, enter your credentials, this will allow Visual Studio to have the credentials needed. Now, go back to the publish profile and retry, it will use the credentials you just entered.

Related

IIS7 MVC Routing Not Working

Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory.
.
What I think is happening...
The user accesses http://server/AppName
Because it's an MVC app, the default route (Reports/Index) should be used.
Instead IIS is looking for a default document...
... and, not finding one, it assumes the user wants to list the contents of the directory...
...which is not enabled so it throws a 403.14.
.
What I've tried so far...
Accessing the route directly.. results in 404 error. So I'm pretty
sure IIS doesn't realise it should use routing.
Use aspnet_regiis to register ASP.Net with IIS. This was done from the Framework64 folder since...
OS is 64 bit - Windows Server 2008 (Standard without Hyper-V)
IIS is 64 bit - though Enable 32-Bit Applications is true
Checked AppPool is targeting v4 of the framework - it is.
Changed AppPool mode to Classic - was pretty sure it should be integrated but was worth ruling it out. It is now back to Integrated
Confirmed RunAllManagedModulesForAllRequests is set to true in the web.config.
Checked permission conditions defined in <system.webServer> section of web.config are met - they are.
Created the simplest of MVC applications and deployed it - same problem.
Running the command shell as Administrator unregistered ASP.Net using aspnet_regiis -ua and re-registered using aspnet_regiis -enable -i. We hit a couple of permission problems - and the Temporary ASP.NET Files directory was missing but once they were address we were back to the same error.
Added a simple default.htm - when present, this is served in response to the http://server/AppName request.
I'm clean out of ideas and all google hits suggest some combination of the above - or enabling directory browsing (which I think is just a symptom rather than the root cause).
Also, not sure if it's relevant but the amount of configurable elements available for the application in IIS seems a bit below what I would have expected...
Have you Checked the user the application pool process is running under? I think Your site needs to run with permissions to execute the .net libraries and I've seen this just change for seemingly no reason (probably related to an overzealous update to the system).
You can try with the Enabling directory browsing .
assuming you are under Windows Server 2012 or Windows Server 2012 R2
On the taskbar, click Server Manager.
In Server Manager, click the Manage menu, and then click Add Roles
and Features.
In the Add Roles and Features wizard, click Next. Select the
installation type and click Next. Select the destination server and
click Next.
On the Server Roles page, expand Web Server (IIS), expand Web
Server, expand Common HTTP Features, and then select Directory
Browsing. Click Next.
On the Select features page, click Next. On the Confirm installation
selections page, click Install. On the Results page, click Close.
if you using the Windows PC try this in your command prompt as follows:
go to C:\Program Files\IIS Express
then press Enter:appcmd set config
/section:system.webServer/directoryBrowse /enabled
Maybe this is your case https://forums.iis.net/t/1157304.aspx
SQL Server Reporting Services creates a folder called Reports by
default if you install it on IIS. If you install SQL 2008 then
Reporting Services doesn't need to use IIS and instead will try to
reserve the URL with the HTTP.Sys service.
I believe this is the cause of the conflict you are seeing. What you
could try is changing the URL that Reporting Services uses via the SQL
Server Configuration Wizard.
Also I found that
Report Manager of SQL Server can use reports path http://<server name>/reports
Configure a Native Mode Report Server for Local Administration (SSRS)
I think the problem is IIS features that are not installed yet. I have met this kind of problem frequently in Windows Pro. Make sure to turn on every feature under Internet Information Service -> World Wide Services because by default IIS is configured to use WebForms. So there might be some features that not installed yet to use MVC, especially ISAPI filters. In my case, that was the solution. I hope it helps.
Something similar i encountered using VS 2017 & ASP.NET MVC.
Was working on the project for long with no problems at all but suddenly the routing started misbehaving & stopped working.
So I changed the Port in Project Properties Page & it started working.
I really don't know what is the relation between a port & MVC routing modules. Someone else can enlighten if at all this helps.
I had the same problem and I just created an application pool out of the Default Web Site in IIS and stoped the default web site. With that difference you will not have the application pool's path
I know it's been a long time since this question but i've had the same problema recently. I've tried every single configuration, just like #amcdermott did, but the only action that solve the problem was reinstalling .NET Framework.
My app was built under .NET Framework 4.5.2. The application server had the version 4.6.1 and 4.5.2 installed. So, i uninstalled all framework versions and installed the one that i needed.
Please, make sure that no other applications use superior versions of .NET Framework if you going to try this solution.
Here are some quote I find on Microsoft official site which I think may help:
For site administrators
This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured. To resolve this problem, use one of the following methods:
Method 1: Enable the Directory Browsing feature in IIS (Recommended)
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Directory Browsing.
In the Actions pane, click Enable.
Method 2: Add a default document
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Default Document.
In the Actions pane, click Enable.
In the File Name box, type the name of the default document, and then click OK.
Method 3: Enable the Directory Browsing feature in IIS Express
Note This method is for the web developers who experience the issue when they use IIS Express.
To do this, follow these steps:
Open a command prompt, and then go to the IIS Express folder on your computer. For example, go to the following folder in a command prompt:
C:\Program Files\IIS Express
Type the following command, and then press Enter:
appcmd set config /section:directoryBrowse /enabled:true

Unable to access the IIS metabase ASP.Net

Hi I know there are a few threads on this but none of the solutions seem to work for me.
I have an ASP.Net website project which I am trying to load and publish in Visual Studio. However when I load the project I get the error:
Creation of the virtuald directory http://localhost:xxxx failed with
the error: Unable to access the IIS metabase. You do not have
sufficient privilege to access IIS web sites on your machine.
This error only occurs when I run Visual Studio as Administrator. If I don't run as admin then the above error does not occur but when I try to publish my app I get:
Please launch Visual Studio under administrator mode to perform this
deployment action
It seems I can't win!
What I've tried so far:
Taking ownership of C:/Windows/System32/Inetsrv/Config
Setting <UseIISExpress>false</UseIISExpress> in my project_name.csproj file
Go back to and old team foundation server check in that didn't have the problem in admin mode and use that configuration.
Running Visual Studio as non-admin (works but note second error above)
None had any luck so far.
Extra Info:
Operating System: Windows 8.1 (64 bit)
Visual Studio: 2013
IIS: 8.5
Permissions on C:\Windows\System32\inetsrv\config (read only):
Me: Full control
Administrators: Full control
Permissions on Documents/IISExpress/config (read only):
Me: Full control
Administrators: Full control
Note "Documents" is on a network drive
It turns out my Personal Folder was set to a network drive which occasionally went down causing the error described.
To change your Personal folder:
Open C://Windows/regedit.exe
Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Change the field Personal to %USERPROFILE% or %USERPROFILE%\{a folder of your choice}
This fixed the problem for me.
Note you may need to move over any files from your old Personal folder to your new one as they wont be picked up any more
Have you tried the following fix ?
Here is the Fix that worked.
"I think we encountered a similar problem at work. For us, the solution was to go into Control Panel -> Programs and Features -> Turn Windows Features on or off... inside that, we had to select Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS Metabse and IIS 6 configuration compatibility.
https://social.msdn.microsoft.com/Forums/en-US/1d5cb9c7-af77-4bcd-8421-e813aff88bd3/help-with-visual-studio-2012-error-unable-to-access-the-iis-metabase?forum=visualstudiogeneral
I had the same problem after I mistakenly Cut and Pasted my Documents, Downloads and Desktop folders to my external hard drive, it changed the path of the folders to the F: drive (the external hard drive), I copied the folders back and set the path back to local.
Copy the items back to C:\Local Disk\Users\your_name
Right click on the folder (that isn't working) and click Properties
e.g Documents
Click on the Location Tab
Change the location to normal e.g C:\Local Disk\Users\your_name\Documents
This is what worked for me :D
Maybe a shot in the dark - but have you tried installing the 'IIS Management Console', 'IIS Management Scripts and Tools' and 'IIS Management Service' from Add/Remove Programs - Turn Windows Features On or Off? That may help.
Left click on your project --> properties. Select WEB. Check the link [port] on project url. Click Create Virtual Directory. Should help.
Step 1: Close if Visual Studio Opened.
Step 2: Open Project Folder and find ".vs" folder, it may be hidden
Step 3: Delete ".vs" folder
Step 4: Open Project Again

Can't start ANY ASP.NET projects

I've been trying to fix this for quite some time now, but I simply can't make any ASP.NET projects in Visual Studio Express 2012 for Web. I get this error when I start a new project:
Web application projects are currently configured to use IIS Express. To switch back to using the Visual Studio Development Server, change the development server option under the Projects and Solutions/Web Projects Category of the Options menu. Configured IIS Express failed with the following error:
Filename: redirect.config
Error: Cannot read Configuration file.
So I went on the internet to try and find others with the same error but I can't find a concrete solution to my problem. I find something similar for older versions, but it doesn't fix my problem. I do have the IIS Manager up under my Services (When you want to Manage Windows). I even made a virtual folder, but to no avail. Still doesn't work.
I want to use IIS
How do I fix this?
In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click Properties
In the Properties window, click the Web tab.
To choose the Visual Studio Development Server, under Servers, click Use Visual Studio Development Server.
To use a specific port number with the Visual Studio Development Server, select Specific port and enter the port number. By default, the Auto-assign Port option is selected, and the port number that has been assigned to your application appears
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, l ocalhost/WebApplication1).
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, loca lhost/WebApplication1).
To choose a custom Web server, select Use Custom Web Server. In the Server URL box, type the URL that Visual Studio should start when it runs the current project.
You may for example open you project file in notepad search for the string <useiisexpress>true</useiisexpress> replace it with the string <UseIIS>True</UseIIS> save and reload the project.
Make a copy of the project file first though.

Deploy website from a Windows XP Desktop

On my Windows XP desktop, I have a fairly simple ASP.NET targetting .net 4 in Visual Studio 2010. I can run it on my local host by ctrl + F5, it works all fine.
I have a Windows Server 2003, that I can access via mstsc, but also via Explorer. When I go to the publish section of my build properties, i see 4 publish methods :
Web Deploy, FTP, File System, FPSE
I have already installed IIS 6 successfully on the Windows Server, and given all authorizations for everything I could so far (to get things to work in the first place, will check on that later).
How should I proceed to publish to that remote machine ? Should I target a specific folder ? Do I need to setup things in IIS 6 for that site first ? Or will it all get settled from te properties I have in Visual Studio ?
Thank you guys,
J.
Personally I've always plumped for a manual deployment; that is I create the Web Site in IIS creating an appropriate AppPool and targeting the correct .NET version to utilise. From there simply copy (xcopy if you will) the appropriate files over, e.g. DLL and all supporting pages such as ASPX, CSS and associated images. In most situations where I have direct / RDP access this is what I run with.
That said, this can be automated from Visual Studio and this can be useful for those situations where you're maintaining an awful lot of sites on a regular basis. With IIS 6 and Visual Studio, this was achieved by installing FrontPage Extensions on the server then utilising the Publish option.
For VS2010 it seems this has been streamlined using the IIS Web Deploy module and configuring the Studio to publish in this manner that looks mildly quick...
HTH
I've never used the Web Deploy feature in 2010, so I can't really tell you about its merits or drawbacks. I've read that it works much better with IIS7 than IIS6. If you have direct access to the IIS root folder on the server (typically c:\inetpub\wwwroot) through a network share I would recommend doing the file system deployment. FPSE works as well if you have to publish to the server through a remote URL, but there are some security issues with FPSE that make enabling it on your web server a less than ideal choice.
Once the files have been deployed, all that should be left is to configure the website as an application inside of IIS.
Remote in to the web server and open IIS
Right-click Default Web Site and choose properties (if you've deployed to a subfolder in the root, then locate that folder and choose those properties instead
Switch to the Home Directory tab (Just 'Directory' for a subfolder)
Look for the Application Settings section and click the button that says Create
Optional: Select an app pool if you have created a custom one from the default
That should enable IIS to execute your .aspx files inside of your application. Once you've successfully configured the app for the first time, you can just keep publishing your app to the same location over and over without having to reconfigure it.

AnkhSVN breaks ASP.NET sharing permissions with SVN 1.7

The Background (skip to the bottom if you want the question)
Recently I upgraded an SVN repository (hosted on assembla) to SVN 1.7. After doing so, we started to intermittently encounter lots of File Access Denied errors on the ASP.NET site pages that sit in the local working copy of the repository.
Some folders also started to get weird file permissions (they became marked read-only) and user sharing got removed from them. These problems would only start occurring after an update/commit cycle, via AnkhSVN's Visual Studio plugin, but not all the time; it seemed highly temperamental.
The only temp-fix we've found so far is to commit any outstanding changes, delete the local copy and re-checkout a full working copy (with TortoiseSVN). However, that is not a viable fix, and it is seriously impacting on productivity.
This site is an Azure based ASP.NET WebWorkerRole. It has never given problems before the upgrade to SVN 1.7. I tried fiddling with the internal IIS permissions to get around the problem, however, no dice.
My Environment
Visual Studio 2010 Ultimate 10.0.40219.1 SP1
AnkhSVN 2.3.10509 (latest version, supports SVN 1.7.1)
TortoiseSVN 1.7.1, Build 22161 - 64 Bit
Running in Debug Mode via the Azure emulator environment
The Question
Is it possible for SVN 1.7 or any of the tools in my environment to break file permissions so that the files become unusable in an ASP.NET site? and more importantly, how do I fix this?
The exact file permission error dumped out is this:
Access to the path '//file//' is denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the
path '//file//' is denied.
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and
the configured application pool identity on IIS 7.5) that is used if
the application is not impersonating. If the application is
impersonating via , the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user.
To grant ASP.NET access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add
the appropriate user or group. Highlight the ASP.NET account, and
check the boxes for the desired access.
But a clean working copy will not generate this error. Comparing the permissions of the two, it seems the working copies that are not bugged are shared (with IUSR and the local account), whereas the broken ones have zero sharing, yet the sharing is never changed by the user.
When subversion updates a file it first creates a temporary version in .svn/tmp/. It then moves the file into the right location. (This to avoid corruptions)
In 1.6 it did this for every directory by itself, but in 1.7 there is just a .svn in the top level directory of your working copy.
If somehow the filesystem permissions of this .svn directory are restricted, it is possible that the restrictions are copied with the file when it is moved in place.
(Subversion doesn't change the permissions itself on Windows)
I solved this by accessing the security settings for the website folder and and clicking Advanced and then Change Permissions for the IIS_IUSRS user. I checked the "Replace all child object permissions with inheritable permissions from this object" and clicked apply.
Before that, I had given the IIS user full permissions to the hidden tmp folder in the root of the checkout, but I don't know if this helps with anything.
I'm not sure if this is a permanent fix, but in case it is not, you can at least use it to reapply permissions for all the files in a single operation.
Much information is located in .svn folders inside directory where project was checked out. So in my opinion better use SVN separately from advanced integration tools. Also this deals with solving problem like this.
I found this exact same issue happened when I did a 'Revert' using:
Tortoise Svn 1.6.16
AnkhSVN 2.3.11269.1348.
Visual Studio 2010 Professional
Windows 7 - 64 bit.
I was completely puzzled the first time I encountered the permissions error and started off by thinking it was my code. After a while of fiddling about I ended up deleting the whole project and re-downloading from Subversion which fixed the issue.
When this problem happened again I looked more closely at the reverted file, and I found the permissions on the reverted files do not match the permissions of the other files. Specifically 'Users' permissions, for the machine that Visual Studio is running on, is missing altogether.
So I just added it in by:
Right clicking on the problem file. This caused the file properties window to appear.
Then clicked on 'Edit...'. The permission window appears.
Then clicked on Add and the 'Select Users, Computers, Service Accounts, or Groups window appears.
Click on the Object Types button and check all the boxes.
Click on the Locations button and make sure your machine name is selected.
Type in 'users' then click the 'check names' button.
Click OK on all the windows to close them.
Your website should now run without the permissions error.

Resources