FTP hosted application forbidden access error - c#

We have published an application using FTP option in visual studio 2017, with a hosted url ex- https://my.base.url and I can access my api by hitting https://my.base.url/api/getMethod.
I have another api which I want to pulish and access like https://my.base.url/app2/api/getMethod and the older one will be https://my.base.url/app1/api/getMethod.
So I published code like this.
enter image description here
When I check the files via ftp://my.base.url/app1 , i could see the files deployed , but when I acccess the same using https://my.base.url/app1/api/getMethod, I am getting 403 access denied . How can I verify this and resolve.This is old web api project which having web.config and global.asax. I dont have direct access to iis , but even its something related to iis issue , How can we verify

Http 403 error is mainly caused by the fact that the directory browser is not enabled. Moreover, the IIS module will not be loaded correctly and thus the application request cannot be handled correctly. In order to run the web application properly, please convert the folder to application.
Besides, we could refer to URL rewrite extension to change the URL route.
https://www.iis.net/downloads/microsoft/url-rewrite
https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
Feel free to let me know if there is anything I can help with.

Related

asp.net MVC, IIS - HTTP 404.0, 403.14

This is my first project in asp.net MVC. Build works in Visual Studio. When I publish website to server I get this two errors:
HTTP 403.14 – Forbidden
I get this one if I visit server based on ip. It says I can probably fix it by setting default webpage. I know where to do it in IIS, but I dont know what to put there. I have only one controller Home, which has Product view. So I tried to set Home/Product, but nothing happend.
HTTP 404.0 – Not Found
This is happens when I try to access to controller, x.x.x.x/Home/Product for example.
Project runs on Windows Server 2012 + IIS. In IIS I use Default Web Site. I added permisson to users from outside by this command IIS APPPOOL\DefaultAppPool.
In Visual Studio I make build through Build > Build web to local drive and move all files to server.
Two things,
Check the app pool identity has permissions to the root folder of
the site.
Check that there is a default page configured in the root folder in
the site and that the default page is listed in the default
documents list for the site.
403 Forbidden The request was valid, but the server is refusing
action. The user might not have the necessary permissions for a
resource.
404 Not Found The requested resource could not be found but may be
available in the future. Subsequent requests by the client are
permissible.
Options:
Is Directory Browsing turns to Enabled?
Is Folder Project Directory User has Permitted?
Check application pool framework(IIS) VS Project Framework.
Always check in application pool > right click created website > advance settings > General tab (32bit or 64bit)
Fix it by this advice: stackoverflow.com/a/9239936/3246527. Thank you all.
I probably followed some bad tutorial which missed this part.

IIS reverse proxy with windows authentication on same server getting access denied

I've viewed a few of the other IIS reverse proxy with windows authentication posts on here and they don't seem to be what I'm trying to do. Hopefully someone will be able to help or spot what I'm not doing or doing wrong.
I've got a server which has a website running on port 80 which I need to present a number of other web applications on. I cannot create new hostnames so I created a virtual directory in the site which pointed to my web apps, however the root site is using .net2.0 app pool which must stay as .net2.0 whereas my ASP.NET MVC apps all need 4.0 app pools. As per the web.config inheritance problem this is not working and I cannot change the web.config in the root to ignore propagation to child web.configs - with me so far? ;-)
To cut a long story short I've now got a virtual directory in my port 80 site which is acting as a reverse proxy to another site on port 81 and this is working fine for anonymous connections. I've tested it with a simple HTML page and I can access it and the url re-writing is working on links in the HTML page, all good so far.
Now I need to enable windows authentication on the port 81 site, so I followed the instructions similar to what is in these links on MSDN site to configure SPN's for the domain account I'm using (DOMAIN\testaccount) and other IIS config's:-
link 1
link 2
The problem is that all I get now is the good old error message:-
Access is denied. Description: An error occurred while accessing the
resources required to serve this request. The server may not be
configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server
configuration. Verify that you have permission to view this directory
or page based on the credentials you supplied and the authentication
methods enabled on the Web server. Contact the Web server's
administrator for additional assistance.
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.34280
I've tried creating a test aspx page which just outputs the server variables to the response but even this is not working.
I can't find anything else to try, initially I thought I'd have to get Kerberos sorted to pass the details from virtual directory to site on port 81 but the MSDN posts say this is not needed, just the SPN's.
Anyone any ideas?
This turned out to be something very simple and me being dumb for not checking! :-)
I spent days trying to figure out why this wasn't working, not sure why I didn't try earlier but I changed the application pool it was running under to use .net2.0 and then my test aspx page worked!?!
Turns out in IIS manager if you click on the root server node itself that under 'ISAPI and CGI restrictions' feature settings that the .net4.0 DLL's were set to 'Not Allowed' but the .net2.0 DLL's were 'Allowed'! I just enabled the .net4.0 changed the application pool back and then voila it works.

Deploying my visual studio web application using IIS

I have publish my website at visual studio . and i try to setup a website by IIS .
What i have done is :
I click Add New Website in ' Sites ' folder in the IIS and when i browse my physical path and pool , there is always the error saying cannot verify access to path , while my pool authentication passed .
this is my first time publishing a site , i want to host my site on localhost so whenever i type localhost it will be my site without running through visual studio . Can anyone help me with the IIS error on cannot verify acess to path ?
this is the look of my error :
I have just spent a long time trying to get to grips with this myself, and I believe I can offer an answer that may help anyone else who comes across this question in future. I think the problem stems from the terminology that is used in IIS, and the fact that you are just trying to deploy one website to localhost in order to test it.
In IIS, a 'Website' (i.e. what you are adding if you right-click Sites and then "Add Website...") is not really what you would commonly refer to as a website. It is just a folder on disk, with a URL binding. The Default Web Site, for example, has the folder \inetpub\wwwroot, and the binding "http:*:80:" which means that any http request (port 80) will go to this "Website". Your website that you have published is not what IIS refers to as a "Website".
In IIS, an individual website is called an "Application". A "Website" in IIS can hold a number of Applications, and you can add them by right-clicking the Default Web Site and choose "Add Application...".
In other words, the Default Web Site in IIS can contain many websites. For example:
http://localhost/eStellar
http://localhost/otherWebsite
http://localhost/thirdWebsite
all of which may be completely unrelated. I would say that the 3 sites above are 3 different websites, but in IIS these are three "Applications" contained within the "Default Web Site".
In IIS, each "Website" must have a unique binding. As you want your website to be accessible from
http://localhost/eStellar
(which is port 80) you should use the IIS Default Web Site, because it has the binding already to port 80 and you cannot create another "Website" in IIS with that same binding.
So right-click on the Default Web Site, and choose "Add Application...". In the dialog box that appears, the Alias is the name that you want to use in the URL after localhost, so in your case this is "eStellar". The Application Pool can be anything, but just choose the DefaultAppPool for now (the choice of Application Pool is another issue entirely). In the Physical Path, enter the place where you published the website to (i.e. what you have in the Physical Path box in the image in your question).
I also get the same "Cannot verify access to path" warning that you show in your image, but this does not affect my ability to access the page at
http://localhost/eStellar
It appears to be saying that it "cannot verify" whether you have access, not that it definitely cannot access the site. This warning was a bit of a red herring for me, as it actually has nothing to do with why I could not set up the site with the same method as you state in your question.
Hopefully now you can access your site at localhost.
These are the steps that need to be done on IIS 7
Right click your default website
Click on add application.
a dialogue will appear you need to give alias and folder path to your application here. along with application pool.
and you are good to go.
Regarding your error, give your login user rights, And if you are using connect as provide the user name and password of your machine to see if your test is successful.

Unable To Access File In IIS 6 Virtual Folder From Web Application

I have a website sitting in a virtual directory in IIS 6.0. Within this virtual diretory there is also a P12 certification that I need to use for accessing an external web service. When I attempt to access this file through the site, I get a "file not found" error.
I have verified that the file is there and have mirrored my local dev enviromnent to match production and all works fine there.
I'm pretty confident that this is a permissions issue.
Can anyone point me in the right direction?
Thanks!
By default, IIS 6 will only serve specific types of files (based on extension) to requesting clients. If you're P12 certification (I'm not sure what that is) file is not one of those, a 404 is exactly what you should receive.
In your IIS admin console, you can modify the list of file types which are processed and/or served.
It sounds like it's possible you're attempting to access this file programmatically, in which case you'll need to provide a bit more information - show us the code that is attempting to access the file, and maybe the exception as well
EDIT:
Based on your comments about the location of the file, you could try doing something along the lines of this:
File.Exists(Server.MapPath("/") + "DLWSCert.p12")
I found that the message of the exception is misleading. The message says was File Not Found but the message was contained within a System.CryptogrphyException. Ultimately, the problem was permissions on the app pool account. Once those were set properly, it worked fine.

System.IO.FileNotFoundException: The Web application at http://SharePoint/ could not be found. Verify that you have typed the URL correctly

I am trying to upload file to sharepoint using webservice.
We have separate server for Sharepoint.
If I publish and debug in my workstation, I get System.IO.FileNotfoundException: The Web application http://Sharepoint could not be found, but if I open the webservice url on Sharepoint server, I am able to upload the file successfully.
I have full admin right on Sharepoint.
I know this is permission issue but I don't know what kind of permission I would need in order to run this.
Please advise. Thank you.
Debugging will not work OOTB except locally on the server the code is being published to. You should be able to debug your code from the http://Sharepoint server.

Categories