Team Foundation Services are not available from server - tfs

OK, I hate to reopen a previously solved case, but I can't get it to work. I have two endpoints listening to events from TFS 2010 event service, one build with Web Service (ASMX) and one with WCF (SVC). The first one works fine. The second causes TFS to raise this error
HistoryId : 4643911
EndTime : 4/12/2013 11:40:31 AM
ResultMessage : There were errors or warnings during notification delivery.
0/0 emails delivered.
1/2 soap notifications delivered.
1 errors.
0 warnings.
-------------------------------
Notification not delivered.
Notification: WorkItemChangedEvent (DeliveryType: Soap; Address: http://[removed]/[removed]/Services/TfsListener.svc)
Exception: Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: Team Foundation services are not available from server
http://[removed]/[removed]/Services/TfsListener.svc.
Technical information (for administrator):
HTTP code 404: Not Found ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.AsyncWebRequest.ExecRequest(Object obj)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ProcessHttpResponse(HttpWebResponse response, Stream responseStream, WebException webException,
XmlReader& xmlResponseReader)
at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ExecWebServiceRequest(HttpWebRequest request, XmlWriter requestXml, String methodName,
HttpWebResponse& response)
at Microsoft.TeamFoundation.JobService.Extensions.Core.TeamFoundationNotificationClient.Notify(String eventXml, String tfsIdentityXml, Subscription subscription)
at Microsoft.TeamFoundation.JobService.Extensions.Core.NotificationJobExtension.SendSoapNotification(TeamFoundationRequestContext requestContext,
TeamFoundationNotification notification, TeamFoundationIdentityService identityService)
JobSource : d9ee5b23-4aa4-4768-a7fb-4db33ab686d0
JobId : a4804dcf-4bb6-4109-b61c-e59c2e8a9ff7
QueueTime : 4/12/2013 11:40:29 AM
ExecutionStartTime : 4/12/2013 11:40:30 AM
AgentId : 917eb9ee-2622-455c-a6e6-a1c96eeb1666
Result : PartiallySucceeded
I have followed every advice I could find, including, 404 Error when TFS 2010 Sends SOAP Alert to a WCF 4.0 Service and http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx.
Any other ideas?

OK, got it work. Here is what is missing from some of the websites out there:
<service behaviorConfiguration="EventServiceBehavior" name="FullSvcClassName">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="EventServiceBinding"
contract="FullSvcInterfaceName" />
</service>
If name of the service will not match your full class name (including namespace), you will get a basicHttpBinding and it will not work.
If you put anything in the endpoint address, like a relative address I thought I should provide, it will get appended to the and of the URI and fail.
I used WcfTestClient.exe and Fiddler2 to track it down. Enjoy!

Related

how to add a status message on a grails respond

I have created a method that is called after every uncatched exception and respond a gson view:
void handleError(){
respond([status: 500, view: "/customErr"], [
code : 500,
message : "whatever internal error",
])
}
this works fine but the main problem that I have is that my client (another server acting as client) is receiving a http response with a 500 status but the status message is null. I've checked the respond docs and I don't see a property message or something.
this if what my client receive:
wslite.rest.RESTClientException: 500 null
and that null is the response's status message that is not set by grails
How can I add a detail message on my respond? idyllically something like this:
respond([status: 500, statusMessage: "my custom
message", view: "/customErr"], [
code : 500,
message : "whatever internal error",
])
grails uses Servlet API’s HttpServletResponse to build response.
now check the java doc for HttpServletResponse class.
there are only 2 methods to define status message:
void setStatus(int sc, String msg) Deprecated. As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use setStatus(int), to send an error with a description use sendError(int, String).
void sendError(int sc, String msg) Sends an error response to the client using the specified status and clears the buffer. The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html".
The first one is deprecated. The second one sends the status message, but it will not send the body - mainly this used for fatal errors...
So, officially by servlet documentation there is no way to send both: message and body in response.
The question is tricky. Because according to Apache Tomcat the "custom status message" feature will be removed starting from version 9: https://tomcat.apache.org/tomcat-8.5-doc/config/systemprops.html#Other
But according to RFC2616 sec 6.1.1 : The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.
This doesn't directly answer your question, and may not solve your issue depending on how much control you have over the application that receives the error, but you can add error messages to the header of the response which should pass through to the client (if it knows to check for them).
String errorMessage = "Whatever Internal Server Error"
response.addHeader("custom-error", errorMessage)
response.sendError(500, errorMessage)
That'll send the message in the header and as the response message... I do not know if this works with respond() or how that interacts with the response object in the controller... but if you're responding to render a view as the error page, you should be able to add the message to the model included in the respond() call and show that on the error page (at least, I'd think so).

Event log warning "URL for this request exceeds the configured maxUrlLength" despite request succeeding

On my IIS server, I'm getting a warning message logged in the server's Application Event Log on a particular variety of incoming HTTP request with a long URL. Despite the warning message, ASP.NET MVC does correctly handle the request and return the expected response back to the client.
The event log message warning message includes the following text:
Event code: 3005
Event message: An unhandled exception has occurred.
...
Process information:
Process name: w3wp.exe
....
Exception information:
Exception type: HttpException
Exception message: The length of the URL for this request exceeds the configured maxUrlLength value.
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
Additional property/value information for the event log warning message:
Source: ASP.NET 4.0.30319.0
Event ID: 1309
Again, in this case the incoming HTTP request is ultimately succeeding, so unlike similar questions my question here is not how to successfully increase the max URL length for incoming requests on my server.
Rather, my question is: Given that my request is succeeding, can I prevent this (apparently spurious) warning message from being logged to my Application event log (adding noise to the log that may obscure other, "real" warnings)?
More details
This behavior (long HTTP request succeeds; warning message written to application event log) is reproducible both on my local workstation PC running Windows 10 and IIS 10, and on my production server running Windows Server 2008 R2 and IIS 7.5.
The project is being built with target framework: .NET Framework 4.5.1. (Update: The error still reproduces after rebuilding my project to target .NET Framework 4.6.1.)
The URLs that trigger the warning message to be written are long URLs (approximately 500 characters in length) of the form (for example):
https://myserver.example.com:443/api/MyDataRequestRoute/1862241,2146171,1998613,1916341,2150391,2067889,749865,2167130,1861707,1914448,668472,2170269,2162087,2024193,1857969,1869304,2162128,1980539,992479,1347745,1958431,282062,1925128,2147391,2153550,1187318,2039442,441327,1298384,2153556,1526985,1893085,2144727,2144288,1582412,2142540,2170281,1183488,1865249,1348332,1322007,2170282,2170283,1750061,2098502,1915955,905164,1353083,2099151,1347806,2160403,2147200,1191371,1347921,1909967,2017687,2012831
The URL is mapped to an ASP.NET MVC Controller method of the form:
[HttpGet]
[Route("MyDataRequestRoute/{commaSeparatedPropertyIDs}", Name = "MyDataRequestRoute")]
public HttpResponseMessage MyDataRequestRoute(string csv)
{
string xmlResult = // Code to build result based on the specified csv...
return new HttpResponseMessage()
{
Content = new StringContent(xmlResult, Encoding.UTF8, "text/xml")
};
}
In order to get these long URLs working, I previously made a few configuration changes to my application and server, specifically:
Set an UrlSegmentMaxLength value of 32766 in the server's Windows registry, per this answer.
Set attributes of the httpRuntime element in my "Api" project's web.config file:
<httpRuntime targetFramework="4.5" maxRequestLength="131072" maxUrlLength="32766" maxQueryStringLength="32766" />
Set the maxAllowedContentLength attribute of the requestLimits element in the same web.config file:
<requestLimits maxAllowedContentLength="134217728" />

wso2 esb how to increase endpoint timeout

I have JMS queue message processor sequence where request is send to SOAP endpoint. However request to this endpoint can take a long time, up to 30 minutes or so. How can I can configure ESB to allow long timeout values ? Currently I'm getting following error after 60 seconds:
[2014-01-20 14:18:31,772] WARN - TargetHandler http-outgoing-4: Connection time out while in state: REQUEST_DONE
[2014-01-20 14:18:31,775] WARN - SynapseCallbackReceiver Synapse received a response for the request with message Id : urn:uuid:c6a023c2-7fb4-4321-b1c2-d78e9bb13add But a callback is not registered (anymore) to process this response
Thanks for any help
Edit: I added http.socket.timeout=1800000 -property in repository/conf/passthru-http.properties which seems to solve the timeout issue.
Assuming this is a "Scheduled Message Forwarding Processor", to increase the send timeout up to 30 minutes :
In your endpoint, verify that "connection timeout" is "never
timeout" (edit the endpoint in the console and "Show Advanced
options")
Edit repository/conf/synapse.properties and modify
synapse.global_timeout_interval (in ms) : this is the maximum time a
callback instance will exist in wso2 to receive the response
copy the sample axis2 conf file
from samples/axis2Client/client_repo/conf/axis2.xml to, for example,
repository/conf/axis2/axis2_mp.xml
Edit this axis2_mp.xml config, find
transportSender name="http" and add a parameter "SO_TIMEOUT" (in ms) : <parameter name="SO_TIMEOUT" locked="false">108000000</parameter>
Edit your Message Processor and in Show Additional Parameters, specify the entry "Axis2 Configuration" to repository/conf/axis2/axis2_mp.xml
SO_TIMEOUT is the time to wait for the response.
You can specify CONNECTION_TIMEOUT for the max time to establish the connection.
Pay attention : all callbacks will persist up to 30 minutes in the ESB !

Bad request on ProcessUserAuthorization (DotNetOpenAuth 4.2.2.13055)

I'm trying to upgrade the DotNetOpenAuth verson to 4.2.2.13055, in the Google dotnet client library.
So I downloaded the latest dlls - DotNetOpenAuth.Core, DotNetOpenAuth.OAuth2, etc. (we still don't work with NuGet).
I made a small change (changed the way I construct NativeApplcationClient with client_id and client_secret) to support the new version.
Then, I tried to run a sample we have in our samples repository (e.g. https://code.google.com/p/google-api-dotnet-client/source/browse/Tasks.SimpleOAuth2/Program.cs?repo=samples), and I got a bad request error, as following:
DotNetOpenAuth.Messaging.ProtocolException: Error occurred while sending a direct message or getting the response. --->
System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions opt
ions)
--- End of inner exception stack trace ---
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions opt
ions)
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request)
at DotNetOpenAuth.Messaging.Channel.GetDirectResponse(HttpWebRequest webRequest)
at DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request)
at DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage)
at DotNetOpenAuth.OAuth2.ClientBase.UpdateAuthorizationWithResponse(IAuthorizationState authorizationState, EndUserAu
thorizationSuccessAuthCodeResponse authorizationSuccess)
at DotNetOpenAuth.OAuth2.UserAgentClient.ProcessUserAuthorization(IAuthorizationState authorizationState, IDirectedPr
otocolMessage response)
at DotNetOpenAuth.OAuth2.UserAgentClient.ProcessUserAuthorization(Uri actualRedirectUrl, IAuthorizationState authoriz
ationState)
at Google.Apis.Authentication.OAuth2.DotNetOpenAuth.NativeApplicationClient.ProcessUserAuthorization(String authCode,
IAuthorizationState authorizationState) in c:\code.google.com\google-api-dotnet-client\default_oauth2\Src\GoogleApis.Au
thentication.OAuth2\DotNetOpenAuth\NativeApplicationClient.cs:line 102
at Google.Apis.Samples.TasksOAuth2.Program.GetAuthorization(NativeApplicationClient arg) in c:\code.google.com\google
-api-dotnet-client\samples_oauth2\Tasks.SimpleOAuth2\Program.cs:line 73
at Google.Apis.Authentication.OAuth2.OAuth2Authenticator`1.LoadAccessToken() in c:\code.google.com\google-api-dotnet-
client\default_oauth2\Src\GoogleApis.Authentication.OAuth2\OAuth2Authenticator.cs:line 124
I noticed also that there is a different in the second request (in exchanging the code with a token): Authorization header was added to the request, and the body was missing my client_id and client_secret.
Similar code worked on old version - 4.0.0.11165,
Am I missing something?
I wonder if the problem is that the newer DNOA version supports putting client credentials in the HTTP header by default. If you create your Client class, passing in a different client credential provider into the constructor, it may work for you.
To change the behavior from using the HTTP Authorization header back to passing client credentials in the POST entity, instantiate your ClientBase-derived class passing in this as a parameter to the constructor:
ClientCredentialApplicator.PostParameter(clientSecret)

DotNetOpenAuth with Yahoo,AOL results in Timeout or NameResolutionFailure

I'm using DotNetOpenAuth 3.5.0.10357 and when attempting to authorize using Yahoo as the provider (https://me.yahoo.com) often times a ProtocolException is thrown at OpenIdRelyingParty.CreateRequest(Identifier). If another attempt is made immediately after the first attempt, the workflow behaves as expected. I've added a XRDS document as per this blog post and when the Yahoo provider responds it seems to detect the file as it no longer displays that verification message. All other providers, with the exception of AOL which has the same issues, work properly at all times. I've enabled logging and there seem to be two different causes, one is a timeout another is a NameResolutionFailure, both from WebException.
Here is the log from the instance resulting in NameResolutionFailure:
HTTP GET https://me.yahoo.com/ WebException NameResolutionFailure from
https://me.yahoo.com/, no response available. Error while performing
discovery on: "https://me.yahoo.com/":
DotNetOpenAuth.Messaging.ProtocolException: Error occurred while
sending a direct message or getting the response. --->
System.Net.WebException: The remote name could not be resolved:
'me.yahoo.com' at System.Net.HttpWebRequest.GetResponse() at
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) --- End of inner
exception stack trace --- at
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) at
DotNetOpenAuth.Messaging.UntrustedWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) at
DotNetOpenAuth.Yadis.Yadis.Request(IDirectWebRequestHandler
requestHandler, Uri uri, Boolean requireSsl, String[] acceptTypes)
at DotNetOpenAuth.Yadis.Yadis.Discover(IDirectWebRequestHandler
requestHandler, UriIdentifier uri, Boolean requireSsl) at
DotNetOpenAuth.OpenId.UriDiscoveryService.Discover(Identifier
identifier, IDirectWebRequestHandler requestHandler, Boolean&
abortDiscoveryChain) at
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.Discover(Identifier
identifier) at
DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier
userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm,
Uri returnToUrl, Boolean createNewAssociationsAsNeeded) Performing
discovery on user-supplied identifier: https://me.yahoo.com/ Filtering
and sorting of endpoints did not affect the list.
The following is the log from a timeout:
HTTP GET https://me.yahoo.com/ WebException Timeout from
https://me.yahoo.com/, no response available. Error while performing
discovery on: "https://me.yahoo.com/":
DotNetOpenAuth.Messaging.ProtocolException: Error occurred while
sending a direct message or getting the response. --->
System.Net.WebException: The operation has timed out at
System.Net.HttpWebRequest.GetResponse() at
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) --- End of inner
exception stack trace --- at
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) at
DotNetOpenAuth.Messaging.UntrustedWebRequestHandler.GetResponse(HttpWebRequest
request, DirectWebRequestOptions options) at
DotNetOpenAuth.Yadis.Yadis.Request(IDirectWebRequestHandler
requestHandler, Uri uri, Boolean requireSsl, String[] acceptTypes)
at DotNetOpenAuth.Yadis.Yadis.Discover(IDirectWebRequestHandler
requestHandler, UriIdentifier uri, Boolean requireSsl) at
DotNetOpenAuth.OpenId.UriDiscoveryService.Discover(Identifier
identifier, IDirectWebRequestHandler requestHandler, Boolean&
abortDiscoveryChain) at
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.Discover(Identifier
identifier) at
DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier
userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm,
Uri returnToUrl, Boolean createNewAssociationsAsNeeded) Performing
discovery on user-supplied identifier: https://me.yahoo.com/ Filtering
and sorting of endpoints did not affect the list.
I'm using the default configuration settings. I'm guessing I cat get around the timeout error by increasing the timeout setting, however I'm not sure how to go about the name resolution error.
From the exception this doesn't look like a DotNetOpenAuth-specific problem to me. It looks like your DNS server is slow or you have a bad connection to it. I'd look into that problem. And yes, increasing the timeout will help you in a pinch.

Resources