Setting network options in a RCP Application - networking

We have a RCP application that does sometimes get some data from URLs in the internet. Our customer uses a Proxy-Server, and we can't get to the information we need unless the network-settings are correct (Setting IP of Proxy and the Port-Number).
In Eclipse (the IDE), there is the Preferences->General->Network Connections Dialog to set those settings. I managed to include the Preferences Dialog( menu.add(new OpenPreferencesAction(window));, and even to get an option "Network Connections" (By adding a dependency to org.eclipse.ui.net in the plugin-settings.) But when I open the dialog, it says "The currently displayed page contains invalid values." and I can't set any values there.
the log files says: (thanks to VonC)
!ENTRY org.eclipse.jface 4 2 2009-11-09 21:51:39.798
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/core/internal/net/ProxySelector
at org.eclipse.ui.internal.net.ProxyEntriesComposite.initializeValues(ProxyEntriesComposite.java:248)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.createWidgets(ProxyEntriesComposite.java:130)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.(ProxyEntriesComposite.java:57)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createProxyEntriesComposite(ProxyPreferencePage.java:81)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createContents(ProxyPreferencePage.java:54)
at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:235)
Does someone know a way to tell an eclipse-RCP application what network settings to use, either by using the preference page, by manual coding, or by using some configuration files?

Looks like I finally got it:
How to make setting the network configuration by the preference page possible in an RCP-Application in windows 32 bit:
Put the packages org.eclipse.ui.net, org.eclipse.core.net and org.eclipse.core.net.win32.x86 into your target plattform and add dependencies to the first two of these in your Manfifest.MF
Make sure you have compatible versions (That was my mistake, I had an old version of org.eclipse.net.win32.x86). For example, get the all three files from your Galileo Eclipse IDE
In your ActionBarAdvisor class, add: menu.add(new OpenPreferencesAction(getActionBarConfigurer().getWindowConfigurer()
.getWindow()));
Putting some DLL-files somewhere on the harddrive is not nessesary!

Howto use eclipse network options in your own plug-in (tested win32):
add jars: org.eclipse.core.net and org.eclipse.ui.net
add jWinHttp-1.0.0.dll (extraced from org.eclipse.core.net.win32.x86) to a directory
that is on the windows path (e.g. c:\windows).
Maybe it is also possible to pass a system property to search the dll at a specific location.
Now you can use the net api.

Related

Server.CreateObject Failed with chiliupload component

I get the following error with a legacy asp application that I have been asked to help out with.
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/site_manager/image_upload.asp, line 27
800401f3
The line ofcode that throws the error is shown below:
Set fbase = Server.CreateObject("chili.upload.1")
As you ahve probably guessed oldschool asp isn't my strong point but from the research I have done it seems as if a component hasn't been registered on the server (I only have FTP access).
What component needs to be regsistered?
Thanks for the help...
You're missing the registration of the DLL that creates the chili.upload.1 object. Are you trying to run this on a Linux machine?
You need to register the Sun Chili!Soft ASP components. Here's the manual on this from 2003:
http://ns7.webmasters.com/caspdoc/html/running_the_setup_program_sun_chili_soft_asp_for_windows.htm. Note that this only works if you still have the original setup. Otherwise you're out of luck. Sun Chili!Soft ASP is no longer available and very, very dead.
If you're just interested in file upload functionality on ASP, I can recommend Free ASP Upload. It requires no registration of any components and generally works. I can also recommend this article on the topic of ASP uploads. If you're willing to shell out some money there are hundreds of components that do the same thing too.
Register the DLL on your computer, and then do this:
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\
FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701
Note If the FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 subkey does not exist, you must manually create it. If you're using a 64 bit OS, you may need to use HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\ FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 instead
Right-click FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701,
point to New, and then click DWORD Value
Type w3wp.exe to name the new registry entry, and then press ENTER.
Right-click w3wp.exe, and then click Modify.
In the Value data box, type 1, and then click OK.
After setting this registry key, a simple app pool restart will apply the change. No longer will your .NET COM components randomly stop working with no real solution except shuffling application pools!

Log4j in Websphere

I recently take over a web application project using websphere and log4j running under AIX. To create a development environment, I setup all the components in windows, using eclipse to compile a WAR file and deploy it.
All is working fine except that log file is not created.
I changed the log file in log4j.properties from something like in below and and give everyone full access permission to the directory:
log4j.appender.F1.File=/abc/def/logs/admin.log
to
log4j.appender.F1.File=c:/logs/admin.log
What else can I check?
I create a simple standalone testapp which use the same log4j.properties and it can create the log file, but when the servlet deployed to websphere, it doesn't work. Please help! Thanks!
Ok, I think this article should help you. It seems that WebSphere CE uses log4j by default and controls it with a global properties file. There is a section on how to use application-specific properties files.
Here is what I try and do to troubleshoot similar issues.
Turn on log4j debugging to see where it actually picks up the file from. You need evidence of which file is picked up (so turning the debug on is a worthwhile activity) This provides you information with what log4j is trying to do to locate the configuration file.
-Dlog4j.debug=true
I would not hardcode the log4j location in the code. Instead I
would use the log4j.configuration System property and state that in
the JVM arguments. This way even I don't need to touch my code.
-Dlog4j.configuration=file:///home/manglu/log4j.properties
I would use this approach irrespective of the runtime server that I use (be it Tomcat or WAS CE or WAS)
Hope this helps
I suggest you use environment variables set on your server like this :
You must access the admin console of your server.
Under custom properties
Server_path=/abc/def/logs
In your log4j, use this : {$server_path}/log.txt
Make sure the user running the app has access to that directory.

How to detect if ASP.NET is enabled in IIS 7

The challenge is to determine whether ASP.NET is enabled within IIS7 in a reliable and correct way.
Enabling/Disabling is done in this case by going into:
Server Manager ->
Roles ->
Web Server (IIS) ->
Remove Role Services ->
Remove ASP.NET
The natural place to determine this should be within the applicationHost.config file. However, with ASP.NET enabled or disabled, we still have the "ManagedEngine" module available, and we still have the isapi filter record in the tag.
The best I can find at the moment is to check if the <isapiCgiRestriction> tag includes the aspnet_isapi.dll, or that the ASPNET trace provider is available.
However these aren't detecting the presence of the ASP.NET config directly, just a side effect that could conceivably be reconfigured by the user.
I'd rather do this by examining the IIS configuration/setup rather than the OS itself, if possible, although enumerating the Roles & Services on the server might be acceptable if we can guarantee that this technique will always work whenever IIS7 is used.
Update
Thanks for the responses. Clarifying exactly what I want to do, I'm pulling settings from a variety of places in the server's configuration into a single (readonly) view to show what the user needs to have configured to allow the software to work.
One of the settings I need to bring in is this one:
The one highlighted in red.
I don't need to manipulate the setting, just reproduce it. I want to see whether the user checked the ASP.NET box when they added the IIS role to the server, as in this example they clearly didn't.
I'd like to do this by looking at something reliable in IIS rather than enumerating the role services because I don't want to add any platform specific dependencies on the check that I don't need. I don't know if it will ever be possible to install IIS7 on a server that doesn't have the Roles/Services infrastructure, but in preference, I'd rather not worry about it. I also have a load of libraries for scrubbing around IIS already.
However, I'm also having trouble finding out how to enumerate the Roles/Services at all, so if there's a solution that involves doing that, it would certainly be useful, and much better than checking the side effect of having the ASPNET trace provider lying around.
Unfortunately, if you don't check the ASP.NET button, you can still get the ManagedEngine module in the IIS applicationHost.config file, so it's not a reliable check. You can also have ASP.NET mapped as an isapi filter, so checking them isn't enough. These things are especially problematic in the case where ASP.NET was installed but has been removed.
It looks like the best solution would be to examine the Role Services. However, API information on this is looking pretty rare, hence the cry for help.
The absolute way to know if they checked that or not is to search the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components
In there you should see two values set to 1, ASPNET and NetFxEnvironment and NetFxExtensibility. This registry key is the IIS Setup key that contains all the components that have been enabled in IIS.
Determining if asp.net is even an installed feature (prerequisite for enabling it) can be done through PowerShell, which implies there is .net api out there for it if you dig hard enough. The PowerShell methods:
Import-Module servermanager
Get-WindowsFeature web-asp-net
Which will return an object of type Microsoft.Windows.ServerManager.Commands.Feature. The installed property is boolean and indicates whether or not the feature is installed.
So do you want the easy way? Make a nice pretty .aspx page that displays as HTML with an error block in a div in a placeholder saying "You need to install ASP.NET" and have it change on ASP.NET being installed to instead say "ASP.NET is installed" and then just have the tool launch this webpage in the default browser after copying it to the directory identified in IIS as the *:80 site (or create the directory mapping in IIS programmatically by altering the XML and then removing it later)
May not be the most elegant but it does ensure that testing shows what features are truly installed versus what's in an XML file.
Because that will scream "do it the lazy ignorant way" I'll remind you that the only way for me to know in javascript what features I can use is to test them before I try to use them, or assume they're there and watch it blow up. My point is, it doesn't matter what gets reported in a file, it matters what you can actually use. Just because C:\Windows\Micrsoft.Net\Framework\v3.xxxxxxxx exists and has files doesn't mean the dll's are registered in the GAC, does it?

Configuring Multiple Web Sites to run under one Web Role

I'm trying to configure my Solution to publish multiple web sites to Azure using the 1.3 SDK and I want them to run under one Web Role. I've added the entry to the Sites element as per the CHM file and when I deploy to Azure the Instance starts up. Now for the symptoms:
Browsing to the "Primary" (first site added to the solution) everything works fine.
Browsing to the "Secondary" site throws the following error:
Exception type: ConfigurationErrorsException
Exception message: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (E:\approot_WASR_\1\web.config line 28)
What have I tried so far without success (sigh):
1. I noticed that by default VStudio (2010 Ultimate) did not include the "Secondary" project output in the cspkg file. Setting a project dependency seems to have fixed that problem (or at least I now see it in the output window during the build process).
2. I've set "Copy Local=true" for the System.Web.Mvc on the "Secondary" project still nothing.
3. I have a CName setup for the "Secondary" project and use the hostHeader parameter on the Binding element so I haven't found a good way of testing this local so I'm limited in diagnostic info.
One thought that I had was that both projects now contain a WebRole.cs file, should that be the case in this configuration? As both of those handle startup events could that be the issue?
I'm not really sure what may be helpful to provide in this scenario so will be happy to fill in the blanks if someone could please direct me a bit. Am I doing this all wrong?
Thanks in advance!
One thing you'll want to make sure is that the second website is built before packaging. It sounds like setting the project dependency probably took care of that.
You can test locally by adding an entry to your hosts file (edit %windir%\system32\drivers\etc\hosts as admin, and add "127.0.0.1 www.mysite.com" at the bottom). This might help you get to the bottom of it.
After you run locally, you should be able to find the .csx directory and check what's in there... make sure the second site (under "_wasr_\1", I believe) looks like you expect it to.
Oh, the second webrole.cs is probably not an issue. (It should be safely ignored.)

Web Deployment Project failed to map path for include virtual

I am building my site with a web deployment project but the build fails with a number of errors all relating to the "#include virtual" directives in my master page.
The includes are necessary to import a set of centrally managed html template files.
Here is an example of the include directive and associated error:
<!-- #include virtual="/v3/sits/pdpdev/assets-templates/inc/head.html" -->
/PDPRegistration.csproj/Pages/ContentPage.Master(15):
error ASPPARSE: Failed to map the path
'/v3/sits/pdpdev/assets-templates/inc/head.html'.
The error for each included file actually appears multiple times. I'm not sure what is being mapped or why, but this was never a problem until I started using WDP (which I wanted to alter web.config depending on the build environment, among other things.)
The project is built locally on my PC and then copied to the web server via a mapped drive. I found a few solutions on the 'net involving IIS metabase - they weren't quite clear to me, and I'm not sure if they apply given how I build and deploy the project (that is, would I have to build on the same system as IIS in order to make use of the metabase?)
Can anyone suggest how I can get my project to build with WDP?
Although SSI's are available within the Framework, the preferred way of doing include is to wrap the content from the file into a User Control (.ascx) as per the MSDN documentation See also: support.microsoft.com/kb/306575

Resources