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).
Related
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.
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.
I'm unable to execute the following from a asp.net web application.
System.Diagnostics.Process.Start("Notepad.exe");
The project builds without errors and it works fine locally. On the live server, it just times out. I spent hours researching this online, only to find that there are others that have had the same problem. So far nothing has worked for me. Most replies seem to suggest looking at permissions. Our IT Director isn't sure how to resolve this issue either.
You probably run the web app on IIS Express locally. That means anything like opening Notepad can work, as it runs under your account in your session.
However, running on full IIS is completely a different thing, as revealed in my blog post,
https://blog.lextudio.com/2015/04/web-application-differences-in-visual-studio-and-iis/
Even if Notepad is opened in that way, it is in session 0 on IIS server side, and you cannot see it.
If you attempt to open Notepad in JavaScript at client side, you might also be forbidden to do so, as browsers run client side web apps in sandboxes, which removes access to the operating system resources.
Usually only web apps that explore the security holes in web browsers can launch Notepad by bypassing sandboxing as well as other security protection mechanism, and you probably won't be allowed to do so in a normal web app.
I'm trying to use a network path (create directory, write and read files) from a Web Service in ASP.NET.
Everything works fine from my office where the network path is in the same LAN of my laptop, but when I try to connect to the network path through a VPN, the creation of a directory fails with "Access to path is denied" error.
The strange thing is that from Windows Explorer I can perfectly access such path, given my VPN credentials, that I stored in Windows Credentials Wallet.
I also tried to set my IIS App Pool Identity to 'Network Service' but no luck.
Can you help me please?
Thank you very much
EDIT:
When I try to execute a statement like
Directory.CreateDirectory(#"\\my\network\path");
from a simple console application project in my Visual Studio 2010 it works perfectly and the directory is created.
The problem is when I hit such a statement inside the business logic of my web service that is running under local IIS (and which I'm connected to via "Attach Process..." debug tool in VS2010)
I may not have all the details of what you're asking straight, but if you're running this service via Visual Studio and VPN, take a look at this great article, at CodeBetter.
runas /netonly /user:domain\username “C:\ProgramFiles\Path\to\your\visualstudio”
I don't have the computer I have this on in front of me, but I recall that I created a batch file and ran it to start VS and Sql Server Management Studio, and it works like a charm.
If I've misunderstood the issue, sorry for the noise.
Sounds like when you are running locally, your local domain account is the context under which everything is being ran. When running the console app, it is still running under your user context since you initiated the application. When running in IIS, you are correct in that the app-pool account is being used, and the networkservice account has some pretty low privileges.
Instead of using a highly privileged account (such as yours), would impersonation solve your issue? Any work that needs to be done over the VPN can "wrapped" in a context the appropriate permissions. Here is another SO article on using impersonation, which I have implemented for related things:
How do you do Impersonation in .NET?
See Matt Johnson's answer where he creates a custom Impersonation class. Use that in a using block, then do your network stuff. It uses the advapi32.dll with p/invoke to do this kind of user account voodoo. He put together a NuGet package as well which may save you some time:
https://www.nuget.org/packages/SimpleImpersonation
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.