Deploying a salesforce.com flex app without visualforce - apache-flex

SHORT VERSION: I have a Flex app that uses Salesforce.com's API. I am trying to deploy it to a remote server but keep getting "Error during login process." when I try to have it log in to salesforce's servers. What gives?
LONG VERSION (maybe someone finds this useful later): I have a flex application that's an add-on for salesforce.com
If I upload it as a static file to salesforce and then embed it in a visualforce page, it works fine. This method uses "loginBySessionId" rather than loginByCredentials.
I would like to be able to run it outside of salesforce's servers. IE, I would like to host the app on my own server and have people enter their credentials in the app and have it login to salesforce's servers. This way, if someone wants to try my application, they do not have to be salesforce administrators and do not have to install the app into a visualforce page.
Here's where the trouble is. If I enter my login information and run it from the compiler, it connects and loads the right data. If I export it as a production release, it still runs fine. However, if I either upload the release files to my own server, or if I transfer them to another computer and run them locally, i get an "Error during login process" Seems some others have had similar issues, but no solutions and nothing new.
Weirder still, if I transfer the project files to another computer and recompile them, it suddenly works. So basically, seems like I have to recompile the app for each computer I plan on running it on, but that's not practical. Even still, I don't see how that could possibly be making a difference, compiling on one vs the other. And yes, same versions of flash, same versions of Flex.
Does anyone have any suggestions on how to resolve this? Am I just misunderstanding something with how to deploy flex applications or is this some screwy thing with the salesforce API and there's a workaround?
As one added thing that makes this problem particularly frustrating is that I can't use the debugger because if I compile it on another computer, it works, so in order for me to get the error I have to build, then transfer to another computer. I feel like this could be a key to the problem, but I'm not sure how.
Here is some applicable code, pretty basic:
<flexforforce:F3WebApplication
id="app" statusChanged="statusChangedHandler(event)"
loginComplete="loginCompleteHandler(event)"
loginFailed="loginFailedHandler(event)"
sessionExpired="sessionExpiredHandler(event)"
serverUrl="http://na9.salesforce.com/services/Soap/u/19.0"
requiredTypes="Account,Contact,Opportunity,Lead,Task,User" />
protected function loginClickHandler( event : MouseEvent ) : void {
_username = 'LOGIN#LOGIN.COM';
_password = 'PASSWORD+SECURITY_TOKEN';
CursorManager.setBusyCursor();
app.loginByCredentials( _username, _password );
}

To clarify, you probably need something like this on initialization :
flash.system.Security.loadPolicyFile("http://na9.salesforce.com/services/Soap/crossdomain.xml");
The reason it works when you compile it is that a lot of the default security is not applicable when on same machine as compiled. Heck, you can even access the hard drive in paths (like a relative URL path to an image on the hard drive) - try running the swf on another computer and bam- no go.
This is an excellent indicator you're hitting a player / VM security issue :)

Related

Xamarin, MobileCenter and an app doesn't start for no reason (apparently)

I'm writing this post because I don't know what I can do.
I'm developing an big app for iOS with a lot of users for my company; to log error and crashes I'm using Microsoft MobileCenter (Analytics and Crashed ver. 0.6), Xamarin.Forms ver. 2.3.3.168 and a lot of components such as Xam.Plugins, SQLite, PCLStorage, SharpZipLib.
As MobileCenter request the minimum target version for the app is 8.
Apart from minor bugs, the big problem is difficult to explain. I'm trying to ask you an advice.
The app is working fine. If I test it, I can't have any problems. At same point the app crashed for any apparently reason. No logs, no crashed, no nothing in MobileCenter. From this moment it's impossible to start the app and I can't have any logs about it: I can see the splash screen but after than the app is crashed again. It seems the problem raises after taking photo with camera.
When the app starts, it deletes images (if there are any in the folder), send a file to my server, and check with CrossDeviceInfo what the OS version is. Then the first page is called.
I tried to understand the problem to read the log in Xcode after connecting my device to my iMac but it's incomprehensible.
If I try to read the View Device Logs I can find one crash for my app but the log is still incomprehensible for me.
Then from Xcode I tried to open Organizer and under Crashes...
If I connect the device with this issue to my iMac and I deploy the app on it, the app is working fine. How can I understand where the problem is to fix it?
Update
In my App.xaml.cs I initialise MobileCenter like the following code:
public partial class App : Application
{
public App() {
// my code
}
protected override void OnStart()
{
MobileCenter.LogLevel = LogLevel.Verbose;
MobileCenter.Start(typeof(Analytics), typeof(Crashes));
}
}
It's Benjamin. I've already replied to you issues in our intercom but I wanted to reply to your issue here.
This scenario is not an actual crash but a kill of the app process by the operation system. The SDK runs as part of the app process and therefor can’t ever figure out that this kill even happened because the process is fully removed right away. Technically this is not a crash from an SDK perspective that it can detect and provide details for. Every single 3rd party SDK has this limitation and there is no way around it as Apple doesn’t provide the technical possibilities to do so.
In addition, none of your provided crash reports contain any reference to Mobile Center thus I can rule out our SDK is the cause of the kill.
I hope you find the cause for the issue.🖖

Why attach debugger to IIS instance

It may be a silly question but why one would like to attach debugger to IIS instance?
These SOs
Attach Debugger to IIS instance
How do I attach the debugger to IIS instead of ASP.NET Development Server?
show you how to do it but could you let me know what are the benefits of doing this?
One time, in my entire career, we had a web app that started getting strange errors that had us baffled. We tried a dozen things to try and figure out what was wrong, but we were panicking and needed an answer immediately. So, we attached a debugger to the production instance and set up a few watch/break points. It helped us track down the errors and fix the problem.
Naturally, it hung the server during our debugging session, and made people mad, but no more mad than they already were, because of the problem we had.
It would not have been necessary if the code had been written better, with error logging and diagnostic points. I don't expect to ever do it again.
Apart from TimG's post a couple of reasons I can think of are:
To debug the application in a closer representation of its
production environment
To debug on a remote machine
Example, like #TonE #1 -- in order to test a deployed website (with web.config transformations) locally, like if you can't remote debug a live website or just need to test config transforms (since you can't run them in-place):
Open site project from C:\Dev\AwesomeWebSite\AwesomeWebSite.sln
Publish the site to a local folder C:\Webs in Release mode (or Whatever mode)
Set up a local IIS website pointing at the published project
Do stuff on the locally-deployed version (e.g. browse pages, make webservice calls, etc)
Attach VS to w3p.exe (appropriate instance) in order to debug the deployed version
You might be able to effectively do the same thing by instead pointing the Project at your IIS website per this answer.

RadEditor ExportToPDF not generating PDF in client's environment

We are using the Telerik RadEditor control, specifically for it's ability to render a PDF via the ExportToPDF() method on the control. We find that this works great in our development and test environments but fails as soon as we get to our client's environment. What I mean by fails is that typically when you execute the ExportToPDF() method, a dialog box pops up with the name of the PDF file, it's size, and whether you want to open it or save it. In our client's environment that dialog window appears, but the file size does not appear. If you save the file, it's a blank document. The machines / environments are equal in their setup (IIS 6 on Windows server 2003). The only exception is that our client's machine is in a secure environment with no access to the internet.
We are loading form letters into the control and then creating the PDF once the user clicks a button, so I don't think this is being caused by bad data / invalid characters causing the PDF not to generate.
My questions are: does anyone have experience running the ExportToPDF() command in an environment with no access to the internet? Could this be a permissions issue? I can't seem to find documentation on whether the ExportToPDF() functionality uses a temporary directory to write the PDF out to while it's rendering. It may be as simple as that, but I'm having a hard time researching this issue.
I've also put a try / catch block around the ExportToPDF() method and I know it's not throwing any errors.
We are running an older version of RadEditor - 2009.3.1208 - it runs in a large application with other Telerik tools so upgrading the entire RadControl suite is not trivial (b/c of testing, etc) and is taking some time.
Any suggestions on what to try next / has anyone encountered anything like this with this control?
Thanks for your help in advance!
Richard
I doubt that the export functionality needs an active internet connection. Most likely something in your secured environment is blocking silently the export and it does not simply happen. My recommendation is to check the permissions/processes you have on the user machine and test the same outside of the local environment to compare the results.

WebService Debug Synchronization (why do my breakpoints give the message "The source code is different from the original version"?)

I'm fairly new to web service development, and I am really confused about how ASP.Net Development Server synchronizes with code during debug mode. When I make changes to my service, I cannot figure out how to propigate those changes so that my client can "see" them (I've been able to synchronize through a stumbling series of publishing the service, viewing the service in browser, etc... but I have a feeling there's a more reliable system than my random ritual).
Here are the symptoms I'm seeing: After I've made a change to the code behind my service (Service1.svc.cs), started the application through the debugger and attached the debugger to the WebDev.WebServer.exe process as well, my latest changes are not executed, and my breakpoints are not hit (they have the message that
"The source code is different from the original version."
What really baffles me, though, is that when the ASP.Net Development Server notification pops up in my system tray, its physical path points to my project folder, so I don't understand how it could be looking at anything but my current code files.
I do not like to play with knives but the only thing that worked for me involves editing the .csproj file itself. So, unload the project file, edit it by cutting and pasting the three asp.net files so that they are together in the ItemGroup. However, sometimes it is necessary to go further as explained here: http://carnotaurus.tumblr.com/post/4130422114/visual-studio-debugging-issue-with-files-of-the-same - Also, I give a list of other proposed solutions that did not work for me. I hope it helps.

ASP.NET MVC - Unable to print ASP.NET Charting control on server

Trying to print an ASP.NET Charting control behind the scenes in my web app. I think it is a permissions issue with the printer as everything is ok up until the point where my code calls:
chart.Printing.Print(false);
bool finished = false;
while (!finished)
{
finished = File.Exists(settings.GetValue("statusfile")); // file which indicates document was printed
System.Threading.Thread.Sleep(1000);
}
At this point the page just freezes (or continues to load endlessly - infinite loop!) Understandably this is happening because I am 100% relying on the document being printed. I do intend to add a timeout, however, at the moment I am just trying to figure out why exactly the document is never being set to the printer!
I have given the account (which the AppPool is running under) permissions to all the relevant folders and even the pdf printer itself...Still nothing.
Am I missing something? Is there any issues with printing on the server side via ASP.NET? I have encountered some issues doing this via WindowsServices in the past not sure if it is a similar problem with ASP.NET websites.
Update
As suggested I updated the AppPool to give myself (admin) permissions and it is the same issue. So by the looks of things the job is never being sent to the printer. I can't seem to figure out why though...
Probably should have mentioned this in my original post....but I am invoking the printer through a referenced DLL, this code is not being called directly from my application (incase it matters). Also this runs fine on my Development machine which is running Windows 7 IIS7.0 where as the server is running Windows 2003 server with IIS6.0.
Update 2
I removed the while loop and just left in the chart.Printing.Print(false) line and turns out the document IS being sent to the printer. So the issue must be with the settings file not getting written which is why the loop never breaks out!
To isolate if this is indeed a permissions issue, you could try running the application using the Visual Studio web development server, which will run under your credentials. Or if that's not an option, temporarily change the IIS app pool so it uses your credentials. If things still do not work, you may have another issue. I'm not sure which charting library you're using (is it the newish Microsoft one?), but maybe Print wants to show a printer dialog.

Resources