Basic question...I have a site running in a VM, say the URL is http://localhost/sites/foo/default.aspx
I want to surf to the URL from my host box, so I get the IP of the VM, and I try:
http:///sites/foo/default.aspx.
When I do, I get an error:
<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>
Shouldn't I be able to do this, isn't this basic?
I also tried using the IP on in a browser on the VM (instead of localhost), but I get the same error.
Thanks
That message means that IIS would like to display a .NET error to you, but your web.config file is not set up to allow that.
I'm not sure where the web.config file is located for sharepoint, but when you find it, you can change it to this:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
That way, you'll be able to see the error message remotely.
You must to place that VM IP into your hosts file and to associate it with your Sharepoint real website (i.e., not localhost)
Related
I cant seem to correctly setup Reverse Proxy for my Jenkins with IIS.
Everything works correctly however I cannot get that message to disappear! Running the "administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/testForReverseProxySetup" is not returning a 200.. but in fact a 404.
I also use the plugin Blue Ocean, I noticed that when running pipelines when accessing Jenkins via my Reverse Proxy, I cannot see the live updates!! I dug into this and found out that it usually is from a bad Revery Proxy setup. If I access jenkins via localhost, I can see Blue Ocean Pipeline updates live, so something must be setup wrong!
What I got:
Windows Server 2019 Datacenter
IIS 10
I have HTTPS setup, so my aim is: Go to jenkins.example.com, it will redirect to https://jenkins.example.com which in turn is a reverse proxy loading jenkins.
My web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules useOriginalURLEncoding="false">
<!-- Enforces redirection of all HTTP traffic to HTTPS -->
<rule name="Enforce HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
<rule name="ReverseProxyToLocalJenkinsRule" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Rewrite" url="http://jenkins.example.com:7070/{R:1}" />
<serverVariables>
<set name="X-Forwarded-Proto" value="https" />
<set name="X-Forwarded-Port" value="443" />
<set name="X-Forwarded-Host" value="{HTTP_HOST}" />
</serverVariables>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
</system.webServer>
<system.web>
<httpRuntime maxUrlLength="4096" />
</system.web>
</configuration>
This seems to be the best working reverse proxy I can obtain, following jenkins tutorials usually leads me to login issues (URL doubling up, i.e: example.com/https://example.com)
P.s, this is the latest windows server image out there and is a clean base build.
I ran through many tutorials however nothing has solved this issue, any advice is muchly appreciated.
I also want to point out that I have one server with Jenkins installed and IIS, Jenkins is accessible at localhost:7070 on the server locally. I also have edited my hosts file on the server to:
127.0.0.1 jenkins.example.com
Where the jenkins.example.com is an actual subdomain/domain pointing to the public IP of my server.
So when I ping: jenkins.domain.com on the server locally.. it returns 127.0.0.1. If I ping outside of that server, I.e.. on my PC, I get the public IP.
EDIT:
I have Application Request Routing installed and below is my config:
I just spent 6 hours of my life debugging this one, and I hope if some poor soul finds this page, as I did, my answer will be of some help. Almost identical situation to the original question, but for the sake of being thorough, I'll detail my exact situation, and my exact solution:
I am running a Windows Server 2019 Datacenter on AWS EC2
My EC2 instance lives under an Application Load Balancer which automatically redirects all http traffic to https, but forwards requests to the server using http only. That is, the user is always connected to the load balancer using https, but the load balancer connects to the server using only http
On that server, I am running Jenkins locally at localhost:8080
I want to reverse-proxy jenkins.mydomain.com to localhost:8080 without configuring SSL at the IIS level
I have read through ALL of the tutorials available on Jenkins' website, other websites with similar "IIS Jenkins Reverse Proxy" tutorials, and all related StackOverflow articles. NONE have solved my issue, and most want you to configure an SSL cert at the IIS level.
Also, I was getting the same mysterious error of the URL doubling up like jenkins.mydomain.com/"http://jenkins.mydomain.com:80"
Here is my exact configuration that solved the issue:
Obviously, you need to configure everything on AWS correctly. If you're not using AWS, make sure that your configuration is comparable.
EC2 Instance with security policy allowing incoming connections on port 80
Application Load Balancer redirects http requests to https, and forwards https requests to your EC2 instance on port 80
Application Load Balancer configured with SSL certificate
DNS configured to direct jenkins.mydomain.com to your Application Load Balancer
As with other tutorials, you must have ARR installed for IIS
UNLIKE other tutorials, do NOT add 127.0.0.1 jenkins.mydomain.com to your hosts file. If you have added it, remove it.
In IIS, Application Request Routing Cache > Server Proxy Settings
Enable Proxy: checked
Reverse rewrite host in response headers: checked
THIS DIFFERS FROM OTHER TUTORIALS, AND IS ULTIMATELY THE KEY THAT CAUSED MY SETUP TO WORK
In IIS, Default Website > Request Filtering > Edit Feature Settings
Allow Double Escaping: checked
In IIS, Default Website > URL Rewrite > Add Rule(s) > Blank Rule
Name: Jenkins Rewrite
Pattern: (.*)
Conditions: {HTTP_HOST} matches .*jenkins.mydomain.com.*
Server Variables: None
Action: Rewrite http://localhost:8080{UNENCODED_URL}
Note that THERE IS NO NEED to include an http to https redirect rule here. If you have one, I don't think it'll hurt anything, but don't get caught up by thinking this is important, as other tutorials suggest.
In IIS, Configuration Editor > system.webServer/rewrite/rules
useOriginalURLEncoding: False
In Jenkins (which you may need to access via loacalhost:8080 at first), Manage Jenkins > Configure System
Jenkins URL: https://jenkins.mydomain.com/
In Jenkins, Manage Jenkins > Configure Global Security
Enable Proxy Compatibility: checked
And that's it! It's possible that some of those steps (especially 9 and 10) may be unnecessary, but in the process of getting to where I am now, those values were ALREADY set, and once it started working I didn't want to change ANYTHING!
Again, the major breakthrough for me was to ENABLE "Reverse rewrite host in response headers".
Edit: Also, by the way, once you get everything working, feel free to just hit the "Disable" button on the Jenkins warning about your reverse proxy configuration being messed up. I think that this situation, and the resulting configuration to make it work, is so non-standard that Jenkins doesn't recognize that it is, in fact, working.
Client gave me a server with public ip. I could see default IIS page in browser locally. Then I did following steps
I published solution (Asp.Net MVC) on my file system.
Copied published folder on server.
Created new website in IIS.
Stopped default web site as it was using port 80.
Assigned port 80 to newly created website.
Opened ip again in browser but it gave me 500 - Internal Server Error.
I made sure following configuration is there in web.config file
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
also added following line in config
<validation validateIntegratedModeConfiguration="false" />
still it showed no details for error even on the server.
I connected same publish folder to my local IIS and it is working fine.
Did I miss anything?
The reason for 500 error can be complicated.
So we have to check several things first.
1.Please ensure IIS asp.net feature has been installed on the client server's side. You can check these configurations by reviewing modules and handler mapping in IIS manager.
2.Please check whether the application works fine when you publish to Client's local folder.
3.Please ensure IUSR, authenticated user and application pool identity has been added to the security group of your folder.
4.Please Check whether special sub-status code or win-32 status code can be found in your IIS log.
5.Please ensure your .net framework and your clients' are the same.
6.Please check whether your application pool has selected the correct mode and runtime version.
With more information, we may find out the root cause of the 500 error.
My ASP.NET MVC application is deployed on Azure app service and was working until today. It won't let me login anymore through the application which uses ASPNET membership. If I run the application in Visual Studio locally pointing to the production azure sql db it works. The deployed app can read data fine but it seems when it tries to login it doesn't while deployed on azure. I haven't changed any code so I don't know why it stopped working on azure when it was. It still allows for reading of data, it displays items in a browse page. I saw this error when I disabled custom errors:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and
that SQL Server is configured to allow remote connections. (provider:
SQL Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
I've checked these questions but they didn't seem to make it work:
Azure SQL firewall
Network interface azure
Azure passwords
Hashed passwords
login works locally not on azure
azure debugging
login register locally not on azure
UPDATE
I used remote debugging and it's failing in a razor view when I check the roles using this line:
if (User.IsInRole("Administrator")) {
I don't know why it was working for a while then stopped but this is what I did to fix it. It was trying to connect to an old membership database connection LocalSqlConnection from a machine.config file. I saw it creating the aspnetdb.mdf in the AppData folder when I would run in visual studio but I am using ASP.NET Identity. I had to modify my web.config like this keep it from using the local db:
Comment out these:
<!--
<membership>
<providers>
...
</providers>
</membership>
<profile>
<providers>
...
</providers>
</profile>
<roleManager>
<providers>
..
</providers>
</roleManager>
-->
Add this:
<modules>
<remove name="RoleManager"/>
</modules>
Add this in <connectionStrings>
<add name="LocalSqlServer" connectionString="same as application database connectionstring"...
The answer from #clayRay in this question gave me most of the answer:
How do I stop using ASPNETDB.MDF in LocalDB?
My work has some dedicated web servers (Server 2008R2, IIS7). Currently everything done here before has just been asp.net webforms. For a new project I want to finally introduce them to MVC. I have a vanilla MVC application created in VS2013. I walked through some different sites and got it set up on my local IIS (full, not express) just fine. I can hit 'localhost' and see the site I created. I am using web deploy, and it worked very well.
After that I moved on to our development server. I set it all up the same (i.e new website in iis, web deploy set up with proper credentials, etc). Publishing from VS works. On the development server I see all the files there, but in IIS on the server (via RDP session) I cannot browse to it. It does not give me a 404 or 503 error, internet explorer just tells me that it can't find the address.
Based off the many, many articles I went through I did the following:
aspnet_regiis.exe -i (32 and 64 bit)
Made sure the server has Web Deploy 3.5 and Web Deploy tools 2.1 installed.
Added some lines to my web.config (see below)****.
made sure the server had .net 4.5 and mvc installed.
After all that it still will not show me the site. Anything I am missing? I would love to find a tutorial to walk me through baby-step by baby-step, but all I see out there assumes that you already have x and y set up, or you already know IIS like the back of your hand.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
To deploy MVC4 Application onto IIS 7.5
Make sure that you installed the latest framework.
Go to %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –ir for 32 bit or
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe –ir for 64 to register asp.net
To be able to work with sites in MVC for IIS7 ir IIS7.5 please update it (http://support.microsoft.com/kb/980368).(Good)
Make sure that there is:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule"
preCondition="" />
<!-- any other modules you want to run in MVC
e.g. FormsAuthentication, Roles etc. -->
</modules>
in web.config. (Good)
Make sure that there is
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
in web.config.(Bad)
from own experience... use "Good"
I have built an MVC 3 application and I have a Web Server 2008 on which IIS 7.5 is installed.
In IIS, I created a new Site and under which an Application then I deployed all my physical files on that application folder:
C:\inetpub\wwwroot\DeveloperToolsPortal\Application
I have also configured my Application Pool so that it supports .NET 4. I also downloaded the MVC3 on this server from the asp.net/mvc3 website.
When I browse this application from IIS using the {0} url, I get the {1} error message:
{0}: http://localhost:85/Application/Home/Index
{1}: HTTP 500 Internal Server Error
The Site was configured to use port 85 as 80 was already taken by another Site.
I've also added the below configurations in the web.config file:
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<customErrors mode="Off"/>
Why is this getting this error? How could I fix it? Which step/s have I missed in configuring my application?
I also tried another thing. I added a simple .htm file under my application and tried openning it via IIS and it gave me the below error:
Internet Explorer cannot display the webpage
I'd guess there is something wrong with my IIS?!
Don't put it in a subdirectory of C:\inetpub\wwwroot
The problem is that by default, there's a web.config file in C:\inetpub\wwwroot, which IIS will read from, even though your site is not directly in that directory.
You can create another folder in C:\inetpub and put your site into there.
Also, you can have multiple sites running with the same port, but using different host headers.
Out of curiosity, where did port 85 come from? Try taking that out (the default port for HTTP is 80). Also, look in the application error log for additional info on the error. There is also a section of web.config that you can set so that detailed error messages will be displayed (which should not be set for production).
<customErrors mode="Off">
</customErrors>
I added some more features/services to my IIS using the Server Manager and registered asp.net with it using aspnet_regiis -ir and this error is resolved.