Web deploy "works" but some files not served - c#

I have VS 2015 and a smallish C# web app. I can debug it on my desktop without issue. I have setup Web Deploy and have deployed the app to a dev server. The puzzling thing is that there are a couple of files that exist on the dev site that are not being served by the IIS server.
In my app I created a "LocalContent" folder at the same level as Views, Models, Scripts, etc with this structure
.../LocalContent/css
.../LocalContent/css/index.css
.../LocalContent/js
.../LocalContent/js/index.js
I can see the BuildAction property for the index.{css,js} files is set to Content and they do exist on the dev server.
When I load the dev site these resources both throw 403 errors (as seen through Chrome's Dev Tools). Not only that, looking at the URIs to these resources does not, for example, give .../LocalContent/css/index.css. Instead the dev-tools networking display shows something more like: .../LocalContent/css/?v=<long string of garble>.
This is my first IIS deployment so I am not sure what is or should be going on. Do I need to do something terribly Microsofty after each Publish event and restart the IIS process or reboot the IIS server machine?

These files are likely being served by IIS's static file handler, which acts as a different identity to your application pool.
Assuming your server is configured with defaults, granting the IUSR user access to your web root (or at least the specific directory)\ that contain the static files) should solve your problem.

Related

ASP.NET website deploys but only I can see

I have a prototype .net web site that is on Windows 10, created using C#. I am using IIS on the same machine to deploy from Visual Studio 2017. It uses SQL Server for back-end data. The site only runs on intranet.
It deploys ok, I can see all the pages, from all three of my machines. But others cannot see anything. They get a run-time error, that does not say anything specific.
My machine was re-imaged and hence the need to redo this.
I looked at IIS log and it does not have any info. What else I can look into?
In web.config, turn off custom error mode to see detailed error message on the client:
How to set web.config file to show full error message
If it works locally and not remotely, it's likely a permissions error (accessing a resource that the client doesn't have access to), or maybe a pathing issue (you are referring somewhere to something by disk or UNC instead of URL, or to a domain that only makes sense to you, like localhost).

IIS Does not refresh changes on web references ASP.NET

I am working over a Virtual Machine using Microsoft Azure, and I installed an app into the IIS, however the when I want to replace the files I've transferred via FTP (From my Local computer to a VM folder) the IIS does not refresh the changes. These are the steps I've run:
Site -- Add new website
Fill up all the required fields
Start the app
but what I can see in the browser is old application, I tried to modified the code but the changes never displayed in the screen.
Note: it is a web service which I try to modified.
Note: I've tried, iisreset, stop the web site, re-start it, re-start the server, deleting the web site, re-create the web site but nothing works.
I am using 4.5.0 in my web app, in [Web.config].
Windows Server 2016.
IIS 10.
Is there something which I am doing incorrectly?
The issue was that there is something in VS2015 solution which does not allow to refresh the web service once the new files are updated via FTP. What I did was to install the https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer and configure the Visual Studio to Deploy the web service to IIS in the Virtual Machine. This was the link which helped a lot.
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis
RECOMMENDATION
DO NOT deploy a web site or service using FTP, it is better to set the ports in the VM and run the deployment from VS properly.
Check to be absolutely sure that you are overwriting the original files. I have seen some ftp clients show a very small status window that can make it easy to assume the files are transferring due to the flood of messages streaming by when in reality there are permissions issues preventing you from overwriting files. Expand the logging window for whatever client you're using so that you can confirm for certain that your files are actually transmitting. If they are, maybe you're dropping them in the wrong folder.

ASP.net: Could not use <database file>; file already in use

I have an ASP.net web application (C#) hosted by IIS on my server that connects with an Access database. It's important that I can have the database open in Access and still use the website at the same time.
I get the "Could not use file; file already in use" error whenever I try this. I've done a ton of research on this topic but nothing really seems to work.
I have modify permissions added for IUSR, NETWORK SERVICE and IIS_IUSRS for the folder containing the database. None of this seems to work.
Oddly enough, I tried hosting the website from my local machine and the solution above solved the issue, but it does not work when hosting the website from my server.
My website also chokes up when trying to do an INSERT statement even when the database is closed. I get the error "operation must use an updateable query"
Any thoughts? Thanks.
In regards to:
but it does not work when hosting the website from my server
I am not sure about the rest of your configuration, but this may shed some light onto why you are getting different behaviors on different systems:
You should enable the same permissions (for the Database folder) for the Identity under which the Application Pool you have configured for your Application in IIS.
Open your Server's IIS Management Console
See what the Application Pool is for your App
right click on the Application node:
'manage Application' >> 'Advanced Settings' >> Application Pool
Open Application Pools View: Find the App Pool
right Click the App Pool >> Advanced Settings
Look for the Identity value
That is the Identity you should replicate the permissions for as you did on your local machine's folders
P.S.: It is usually recommended that you configure/create a dedicated App pool for each of your applications.
Hope this helps resolve your issue.

What configs should be required to connect .aspx online?

I'm pretty new learning c#, and ASP.NET. I want to connect the page I've written with visual studio2012 using IIS. I know how this works on local, but I don't have a clue about making this work online.
For example, when I debug my asp.net page, the directory is:
localhost:2791/WebForm1.aspx.
This project is saved on the IIS root directory, and all the configs for the IIS seems to be fine.
But when I try to access this such as, myip/WebForm1.aspx, it doesn't work.
What am I missing?
Firstly you need to host your web application in the IIS.
I am assuming that, you have correctly hosted your application in the IIS.
Now, try accessing it with address localhost:portnumber/virtual directory,
if you are able to access, then go ahead and read the answer below, otherwise, you simply have not hosted your app properly in IIS.
Now, to access your IIS hosted website through your IP address +Port number(if not default), you must check if Firewall has not blocked it.
For enabling access to your IIS hosted website through your IP, do this:
goto Control Panel\System and Security\Windows Firewall\Allowed Programs and make sure property World Wide Web Services (HTTP) is checked (for all the networks)

Move a Web Site project with a web service to AWS windows server

I've started ut a new instance of a windows server 2008 and am trying to move and launch my web service I've created in Visual Studio. How do I move the project from my local computer to the remote desktop? Grateful for all help!
I've tried the really simple approach and just copied the directory to the remote desktop in the same location as on my local computer. Did not work.. When I try to access the same adress that it has on my local computer (http://localhost:80/somesite all I get is this:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
I'm probably going about this the wrong way, but don't know where to start..
Sounds like you need to setup IIS. See the following link http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0
I would make sure asp.net is enabled in the IIS server. Also try to explicitly hit your page such as:
http://localhost:80/somesite/myhome.aspx
I'm sure there is a quick answer to your particular issue, but if you're going to be doing this sort of thing often, it is best to take some time up front and read up, then click around and get a feel for IIS.
http://msdn.microsoft.com/en-us/library/ms178477.aspx
Visual Studio has abstracted much of the site/virtual directory setup and configuration, chances are you can't just copy the files over and have it work. There are lots of things to think about: websites versus virtual directories and their configurations, application pools and their identities, file permissions, default documents, etc. enjoy.

Categories