BrightcoveOS/.NET-MAPI-Wrapper

A connection attempt failed

Closed this issue · 20 comments

Hi,
I'm having this issue trying to use the .NET-MAPI-Wrapper and im sure its something simple im missing but could you possibly point me in the correct direction?

Here is the error i get when running this code.

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

I'm just trying to use one of your examples but im trying to figure out if i missed a setting or soemthing?

long _id = MyworkVideoId;
BrightcoveApi api = BrightcoveApiFactory.CreateApi("MyWorkReadKey");
//messing with timeout here
api.Configuration.RequestTimeout = 999999999;
BrightcoveVideo video = api.FindVideoById(_id);

This should work correct?
Thank you,
Tom

That looks ok at a glance...

In general, you shouldn't have to mess with the timeout when performing a simple find_by_id. What sort of network are you on? My initial suspicion is that there could be a firewall causing problems in between your computer and the Brightcove network.

Do you get a response if you manually craft the URL and enter it into your browser? Try this URL: http://api.brightcove.com/services/library?command=find_all_videos&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.

That's from the Brightcove API docs and will retrieve videos from their example account. If that works for you within a browser on the computer in question, then in theory so should .NET wrapper.

Yes I am able to pull back results when using an example like that in a browser, and also thanks for the very quick response!.
I switched the token to my token and i can pull back all our videos.

Sorry, to clarify. I can pull back information posting a link in the browser but i am still having the same problem in the .NET wrapper.

Ok, that's interesting... The .NET wrapper should be reaching out to the Brightcove server in very much the same manner that the browser does.

Is there anything unusual about the computer on which you're testing? For instance, is it a partial trust environment? (Not sure how that would affect things, but I've never tried this code under partial trust.)

Have you customized the .NET wrapper using any of the hooks described in the wiki? Or is it basically the out-of-the-box version?

Here's a thought... is your web browser configured to work through a proxy? The browser could potentially be running through a proxy without you even being aware, if your network administrator has set up one of several auto-configuring protocols. If so, you can configure the .NET wrapper to work through a proxy, too: https://github.com/BrightcoveOS/.NET-MAPI-Wrapper/wiki/Customizing-Request-Properties

I will try this and get back to you tomorrow, Thanks!

oh and its the out of box version.

It does have a proxy.
I have the name of the proxy and the port. Im afraid im a bit over my head with this though even with the example you linked me. Is that the easiest way to apply the proxy information to the code snippit I sent above?
Thanks

Yes, you'll have to modify things in the manner described by the wiki article. It should be relatively straightforward, but I'm happy to provide some assistance if you get stuck.

https://github.com/BrightcoveOS/.NET-MAPI-Wrapper/wiki/Customizing-Request-Properties

The code that's shown there should be almost exactly what you need, though perhaps you won't need to specify credentials, and you may need to specify a port. Don't forget to instruct the API wrapper to use your custom request builder after you create the wrapper instance: api.Connector.RequestBuilder = new MyRequestBuilder(api.Configuration);

If i do not want to build a new class but just have this as a single line in my code can i do this by putting something like api.connector.requestbuilder.(something)?

Didnt mean to close the issue..

The only way that currently exists to customize the manner in which the .NET wrapper connects to Brightcove's server is by writing a new IRequestBuilder. The easiest way to do that is it subclass BasicRequestBuilder as described in the wiki. If you're having trouble getting that to work, I'll provide what assistance I can.

I suppose you could alternatively try moving your operation to a different network, or ask your IT department to open a hole in the firewall for you such that you wouldn't be required to connect via a proxy.

anyway i could discuss over email so i can show you some code snippits which i cant really show on the internet

Sure, email me at dave at millz dot com.

great thanks Dave!
I sent you an email

Hi tpriscu,

I don't see any email from you. (checked spam folder, too)

Resent email, that was my fault.

Hi Tom,

I received your emails this time, but I'm busy at work yesterday and today. I'll try to follow up with you again in the near future.

Thanks Dave that would be very helpful since i am currently stuck on this issue.

Hi Dave,
I figured it out i believe.
I had to add
myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";

to myRequest and seems to be working now
Thanks!

Fantastic! Glad to hear it's working.

I'm going to go ahead and close this issue. Good luck with the rest of your project :-)