IIS Express fails to create virtual directory - visual-studio-2013

I have a web project that uses IISExpress and when attempting to load the project I receive the exception message below.

Related

Visual Studio 2017 Web publishing fails if user is non-admin while the same user can be used for VS2015 web publishing on the same web server

I am trying to publish a ASP.NET Core Web project to IIS (remote server) using a non-admin account using Visual Studio 2017 and I have the following error on deploy:
Starting Web deployment task from source:
manifest(D:\Projects\Own\AspNetCore\CoreWithAngularTrial\CoreWithAngularTrialApi\obj\Debug\netcoreapp1.1\PubTmp\CoreWithAngularTrialApi.SourceManifest.xml)
to Destination: auto(). C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(134,5):
Error : Web deployment task failed. (Connected to the remote computer
("...") using the Web Management Service, but could
not authorize. Make sure that you are using the correct user name and
password, that the site you are connecting to exists, and that the
credentials represent a user who has permissions to access the site.
Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.)
Make sure the site name, user name, and password are correct. If the
issue is not resolved, please contact your local or server
administrator. Error details: Connected to the remote computer
("...") using the Web Management Service, but could
not authorize. Make sure that you are using the correct user name and
password, that the site you are connecting to exists, and that the
credentials represent a user who has permissions to access the site.
Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
The remote server returned an error: (401) Unauthorized. Publish
failed to deploy.
I have the following configuration for deployment:
Publish method = Web deploy
Server = servername:8172/msdeploy.axd
Site name = Default Web Site/CoreWithAngularTestApi
User name = username
Password = ******
The exact same configuration works when publishing a different application (ASP.NET MVC 5) under the same Web site (Default Web Site), so publishing configuration appears to be correct on the remote server.
Making username a local administrator unblocks the publishing process in Visual Studio 2017.
Also, publishing configuration files (*.pubxml) are virtually identical.
Event viewer on remote server catches the following error:
IISWMSVC_AUTHORIZATION_SERVER_NOT_ALLOWED
Only Windows Administrators are allowed to connect using a server
connection. Other users should use the 'Connect To Site or
Application' task to be able to connect.
Process:WMSvc User=username
Question: How can I enabled non-administration web publishing from Visual Studio 2017?
This issue has been fixed: https://github.com/aspnet/websdk/issues/146.
ASP.NET core project uses a different set of Publish targets (hence the change in behavior from MVC5). This project is available on GitHub - https://github.com/aspnet/websdk.
I managed to figure out why the publish fails with non-admin user. Server setup is correct, but Visual Studio publishing seems to treat ASP.NET Core Web app deployment differently from ASP.NET MVC 5 one.
I had to explicitly specify web site name within the publishing profile xml file. So, instead of:
<MSDeployServiceURL>servername:8172/msdeploy.axd</MSDeployServiceURL>
I put
<MSDeployServiceURL>servername:8172/msdeploy.axd?Site=Default Web Site</MSDeployServiceURL>
NOTE: This problem does not occur when publishing an MVC 5 project within VS2017.

Visual studio debug access to external database

I have a question as to how the Visual Studio 2013 debug emulator for Web API works.
I had built a Web API project in Visual Studio 2013 to access a database on an external server. The code was built using VS2013's ASP.NET Web Application project template for a Web API application. Once built, running debug opened a browser window for localhost port 56618, which allowed access from Fiddler to test Http requests.
Once I had the project finished, I published it to a website using Web Deploy to IIS. However, whilst the page would open (now at localhost:9812), an http request would throw an Internal Server Error 500.
Perusing the IIS FailedReqLogFiles, I noticed that the reason that it was failing was that the database server was refusing access to '<Domain>\<machine-name>$'.
I added '<Domain>\<machine-name>$' as a valid login (windows authentication, as the connection string included "Integrated Security=true") on the sql instance with read and write privileges, and the problem was resolved.
The question is, why didn't the Visual Studio debug emulator have the same issue?
Because the emulator was running the website under the context of your own account (e.g. <Domain>\You). Your account had access to the database, so there was no issue.
When you published it to IIS, it started running under the context of a different account (<Domain>\Machine-Name - but there are other variants depending on how IIS is configured, and the version of IIS), which didn't have access to your database.

Visual Studio Web Package - doesn't appear to create full Application

I've got a .Net 4 ASP.Net application developed with VS 2012. I'm publishing the app with a publish profile set to create a Web Deploy Package, which I'll be copying over and creating on a Win2008 IIS7.3 server.
When I run the deployment script, server-side, with a "/Y" parameter, it appears to work correctly.
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:package='C:\ReconTool\test\deploy\ReconTool.Presentation.Web.zip"
-dest:auto,includeAcls="False" -verb:sync -disableLink:AppPoolExtension
-disableLink:ContentExtension -disableLink:CertificateExtension
-setParamFile:"C:\ReconTool\test\deploy\ReconTool.Presentation.Web.SetParameters.xml"
Info: Adding sitemanifest (sitemanifest).
Info: Creating application (Default Web Site/ReconToolTest)
Info: Adding virtual path (Default Web Site/ReconToolTest)
...
But the new web site doesn't run for me - I get an 403.18 - forbidden error. When I look in inetmgr on the server for the new app, I only see the 'IIS' config section, where applications I've created manually have an 'ASP.Net' and the 'IIS' config sections.
It appears like it's not creating a full application, there are no error pages, etc, that are configured in the ASP.Net section. Wierd thing is I see the new app via appcmd as an application:
APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/ReconToolDev" (applicationPool:ReconToolDevPool)
APP "Default Web Site/ReconToolTest" (applicationPool:ReconToolTestPool )
Both the Dev and Test application pools appear to be exactly the same, from what I can tell. The web.config in my Dev and Test applications are identical.
I'd appreciate any advice on additional steps I need to deploy an Visual Studio project and get it to config as an application in IIS.
Corey.

ASP.NET MVC3 webdeploy: database deployment on production

I am using webdeploy to deploy my web application to IIS. I followed Microsoft's 12 part tutorial for this. I successfully deployed it on my local IIS.
I have to now deploy this to production and I am following the same steps. I am connected to the remote machine via VP. Form VS2010 publish profile the connection to the server was successful. But when I enter the DB connection string as
"Data Source=xxxx\SQLExpress;Initial Catalog=SWSS;Integrated Security=True"
and try to preview the Database, I get the following error:
Web deployment task failed. ((4/1/2013 9:18:42 PM) An error occurred when the request was processed on the remote computer.)
(4/1/2013 9:18:42 PM) An error occurred when the request was processed on the remote computer.
Exception has been thrown by the target of an invocation.
Member 'ClassName' was not found.
The remote machine does not have TCP/IP enabled.
1. Is it safe to enable this in production machine?
2. If not, how to deploy DB, taking advantage of the dbdacfx?
Update 1:
Based on the comments below, I have changed my connection string as follows:
"Data Source=SWSS\SQLExpress;Initial Catalog=SWSS;User Id=xxxx;Password=xxxx;"
I created a sysadmin user in SQL server with SQL authentication rather than Windows authentication. Now the error is as follows:
Web deployment task failed. (Could not generate deployment script.
Unable to connect to target server.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.)
Update 2:
Using mixed mode authentication on SQL Server fixed my issue.

How to use MsDeploy to deploy a sub-application within a website

I have a sub application underneath an IIS website, and I can deploy it using the publish wizard in Visual Studio no problem.
However, I'm automating our deployment from our build server so I prefer to use msdeploy.exe directly.
I can deploy the main website, but trying to deploy the sub application refuses to work.
This works (www.mymainwebsite.co.uk being the IIS website):
msdeploy.exe
-source:package='www.mymainwebsite.co.uk\obj\Test\Package\www.mymainwebsite.co.uk.zip'
-dest:auto,computerName='https://testweb1:8172/MsDeploy.axd?site=www.mymainwebsite.co.uk',userName='xxx',password='xxx',authtype='Basic',includeAcls='False'
-verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"www.mymainwebsite.co.uk\obj\Test\Package\www.mymainwebsite.co.uk.SetParameters.xml"
-allowUntrustedInfo
This doesn't (SubApplication being the application path):
msdeploy.exe
-source:package='SubApplication\obj\Test\Package\SubApplication.zip'
-dest:auto,computerName='https://testweb1:8172/MsDeploy.axd?site=www.mymainwebsite.co.uk/SubApplication',userName='xxx',password='xxx',authtype='Basic',includeAcls='False'
-verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"SubApplication\obj\Test\Package\SubApplication.SetParameters.xml"
-allowUntrustedInfo
The error is:
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("testweb1") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error: The remote server returned an error: (401) Unauthorized.
As I said, this works from the Visual Studio publish wizard, setting the Site/application property to www.mymainwebsite.co.uk/SubApplication, so I know it's not a permissions issue on the server.
Am I missing something in the msdeploy parameters?
I use the following on the command line to set the web application:
-setParam:name="IIS Web Application Name",value="www.mymainwebsite.co.uk/SubApplication"
In order to do a web deployment to sub-application of a main site, go to TFS, Deploy IIS App step, update the Override parameters to something like this
name="IIS Web Application Name",value="MainSite/SubApplication"
It should do the trick!!

Resources