self-host

37 views
Skip to first unread message

Ivan Tropa

unread,
May 20, 2014, 10:08:20 AM5/20/14
to ironf...@googlegroups.com
Hello

My web services are hosted in the console app via the http listeners. I'm not able to start it in the IF. Is it possible to run the console apps and use them for the self-hosting purpose or as "workers" for any background tasks?

Thanks,
Ivan

Button, Brian

unread,
May 20, 2014, 10:27:37 AM5/20/14
to ironf...@googlegroups.com
Hi, Ivan,

What happens when you try to start them? If you could do a `cf logs my_app --recent` and paste the output in here, it might help figure out what's happening. Also, I've found that for console apps or background workers, I've had to add --no-route when I push. 

Also, if you’re trying to start a console app, try naming it app.exe. As of right now, that’s the default name for console applications. We have on our short-term road map a story to allow the user to specify what exe to run at push time, but we haven’t gotten to it quite yet.

bab
--
Brian Button | Product Manager, Application Services
CenturyLink Cloud



--
You received this message because you are subscribed to the Google Groups "Iron Foundry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ironfoundry...@googlegroups.com.
To post to this group, send email to ironf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ironfoundry/fa4e7645-097d-416a-944b-54ed9d33ff06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


This message contains information which may be confidential and/or privileged. Unless you are the intended recipient (or authorized to receive for the intended recipient), you may not read, use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message and any attachment(s) thereto without retaining any copies.

Ivan Tropa

unread,
May 20, 2014, 4:18:31 PM5/20/14
to ironf...@googlegroups.com
Brian

Thanks for the log command. The problem in the access denied.
Probably it is not possible to run the console app with HttpListener because 
  • you should run the app as Administrator
  • or reserve the app URL for non-administrator account with something like this "netsh http add urlacl url=http://myapp.beta.ironfoundry.me:3000/ user=SERVER\Test 
Could you provide your opinion is it possible to use the second approach? Or the only way for the web services is IIS instead of the http listeners?

Thanks,
Ivan

brannon.jones

unread,
May 20, 2014, 4:51:12 PM5/20/14
to ironf...@googlegroups.com
Ivan,

What port are you listening on with your HttpListener?  IronFoundry should be assigning you a port and granting access to that port via netsh already.

The assigned port is passed via the VCAP_APP_PORT or PORT environment variables.

Brannon

Ivan Tropa

unread,
May 21, 2014, 3:43:43 AM5/21/14
to ironf...@googlegroups.com
Hello Brian

I have attached a small console app - just several C# lines + manifest with the PORT. In my tests it results in the http listener Access issue

2014-05-21T10:19:50.10+0300 [DEA]     OUT Starting app instance (index 0) with guid 603e3f02-8278-49ee-a4da-76a240691286
2014-05-21T10:19:53.99+0300 [App/0]   ERR Unhandled Exception: System.Net.HttpListenerException: Access is denied
2014-05-21T10:19:54.07+0300 [App/0]   ERR    at System.Net.HttpListener.AddAllPrefixes()
2014-05-21T10:19:54.08+0300 [App/0]   ERR    at System.Net.HttpListener.Start()
2014-05-21T10:19:54.08+0300 [App/0]   ERR    at app.ServerProgram.Main() in d:\project\cloud\if\app\app\Program.cs:line 16
2014-05-21T10:19:54.10+0300 [DEA]     OUT Instance (index 0) failed to start accepting connections

Could you please take a look into the matter if you will have a time of course.

Thanks,
Ivan


On Tuesday, May 20, 2014 5:08:20 PM UTC+3, Ivan Tropa wrote:
app.7z

Brian Button

unread,
May 21, 2014, 12:10:15 PM5/21/14
to ironf...@googlegroups.com
Hi, Ivan,

I think we have it. There were a couple of things that we had to change in your code to get it to work. Here is the updated code:

            _listener = new HttpListener();
            var port = Environment.GetEnvironmentVariable("VCAP_APP_PORT");
            _listener.Prefixes.Add("http://*:" + port + "/");

Cloud Foundry assigns a random port to your application, and that's the only port you have access to. The router component on the front of CF intercepts requests for your app and redirects them to the appropriate DEA and your unique port. So your application has to look for that port in the VCAP_APP_PORT variable and listen on it.

The other problem is that we discovered that the URI prefix that you add has to exactly match the firewall rule as it was added through netsh. In our case, this is "http://*:port/".

Once these two changes were made, I was able to push the application with `cf push your_app -s windows2012`.

If this doesn't work for you, please let us know! You can look for a blog post on this shortly at http://www.ironfoundry.org/blog/

-- bab



--
You received this message because you are subscribed to the Google Groups "Iron Foundry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ironfoundry...@googlegroups.com.
To post to this group, send email to ironf...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Brian Button
Product Manager, Application Services
Tier 3/CenturyLink Cloud
@brianbuttonxp

Ivan Tropa

unread,
May 21, 2014, 4:02:25 PM5/21/14
to ironf...@googlegroups.com
Brian

thank you so much! it works.

Ivan.


On Tuesday, May 20, 2014 5:08:20 PM UTC+3, Ivan Tropa wrote:

Button, Brian

unread,
May 21, 2014, 4:32:34 PM5/21/14
to ironf...@googlegroups.com
You’re very welcome, Ivan. I’m glad its working for you!

bab

--
Brian Button | Product Manager, Application Services
--
You received this message because you are subscribed to the Google Groups "Iron Foundry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ironfoundry...@googlegroups.com.
To post to this group, send email to ironf...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages