Flash WebSocket Disconnect - actionscript-3

I'm using AS3WebSocket module to connect web sockets. It works well when I launch flash locally (flash file is marked as trusted in global settings).
But when I open server page with flash, it doesn't work. I've no error messages, just "disconnect" in log.
WinServer2012, IIS, ASP.NET MVC4
Here are logs:
ws init begin: ws://www.sample.biz/WsHandler.ashx?userId=5
Disconnected null[object WebSocket]
And code:
function SYS_wsInit_begin():void
{
writeLog("ws init begin: " + ws_init_url);
trace(ws_init_url);
try
{
websocket = new WebSocket(ws_init_url,"*");
websocket.addEventListener(WebSocketEvent.CLOSED, handleWebSocketClosed);
websocket.addEventListener(WebSocketEvent.OPEN, handleWebSocketOpen);
websocket.addEventListener(WebSocketEvent.MESSAGE, handleWebSocketMessage);
websocket.addEventListener(WebSocketErrorEvent.CONNECTION_FAIL, handleConnectionFail);
websocket.connect();
}
catch (err:Error)
{
writeLog("ws init failed: " + err.message + err.name);
}
}
function handleWebSocketClosed(event:WebSocketEvent):void
{
writeLog("Disconnected " + event.message + event.target);
trace("Disconnected");
}
function handleWebSocketOpen(event:WebSocketEvent):void
{
writeLog("Connected");
trace("Connected");
}
function handleConnectionFail(event:WebSocketErrorEvent):void
{
writeLog("Connection Failure: " + event.text);
trace("Connection Failure: " + event.text);
}
crossdomain.xml:
<?xml version="1.0" encoding="utf-8" ?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
I've also installed Socket Policy File Server with file:
<?xml version="1.0"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<site-control permitted-cross-domain-policies="*" />
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
What can I do?

Oh, I've resolved the problem.
After reading, http://forums.adobe.com/message/5297747 I've tried to check 843 port with fiddler, but I got only a redirection to index page.
I checked my IIS configuration. There was a binding on 843 port. After the binding was deleted and socket policy file server restarted the Web-socket connection was established!

Related

Pphunit keeps giving error: [1049] Unknown database ':memory:'

I just started working with phpunit in Laravel 7. I run into a problem that I cannot find a solution for. I am using Laravel 7 with Xampp.
My phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpcd ..
cdit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="mysql"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
My test function:
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
class ThreadsTest extends TestCase
{
use DatabaseMigrations;
public function test_a_user_can_browse_threads()
{
$response = $this->get('/threads');
$response->assertStatus(200);
}
}
When I run phpunit (vendor/phpunit/phpunit/phpunit) I get this:
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
.E 2 / 2 (100%)
Time: 1.57 seconds, Memory: 20.00 MB
There was 1 error:
1) Tests\Feature\ThreadsTest::test_a_user_can_browse_threads
Illuminate\Database\QueryException: SQLSTATE[HY000] [1049] Unknown database ':memory:' (SQL:
SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:631
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:339
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Schema\MySqlBuilder.php:99
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Schema\MySqlBuilder.php:48
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\WipeCommand.php:69
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\WipeCommand.php:46
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:33
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Util.php:37
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:91
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:35
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Container.php:592
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:134
C:\xampp\htdocs\forum\vendor\symfony\console\Command\Command.php:258
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:121
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Concerns\CallsCommands.php:56
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Concerns\CallsCommands.php:28
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\FreshCommand.php:41
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:33
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Util.php:37
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:91
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:35
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Container.php:592
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:134
C:\xampp\htdocs\forum\vendor\symfony\console\Command\Command.php:258
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:121
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:911
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:264
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:140
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Application.php:93
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Application.php:185
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:263
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Testing\PendingCommand.php:171
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Testing\PendingCommand.php:291
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:52
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\DatabaseMigrations.php:16
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:119
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:84
Caused by
PDOException: SQLSTATE[HY000] [1049] Unknown database ':memory:'
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:46
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connectors\MySqlConnector.php:24
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php:184
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:926
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:961
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:405
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:631
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Connection.php:339
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Schema\MySqlBuilder.php:99
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Schema\MySqlBuilder.php:48
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\WipeCommand.php:69
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\WipeCommand.php:46
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:33
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Util.php:37
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:91
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:35
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Container.php:592
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:134
C:\xampp\htdocs\forum\vendor\symfony\console\Command\Command.php:258
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:121
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Concerns\CallsCommands.php:56
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Concerns\CallsCommands.php:28
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\FreshCommand.php:41
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:33
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Util.php:37
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:91
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:35
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Container\Container.php:592
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:134
C:\xampp\htdocs\forum\vendor\symfony\console\Command\Command.php:258
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Command.php:121
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:911
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:264
C:\xampp\htdocs\forum\vendor\symfony\console\Application.php:140
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Application.php:93
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Console\Application.php:185
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:263
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Testing\PendingCommand.php:171
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Testing\PendingCommand.php:291
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:52
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\DatabaseMigrations.php:16
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:119
C:\xampp\htdocs\forum\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:84
ERRORS!
Tests: 2, Assertions: 1, Errors: 1.
Also the tables in my MYSQL database are all deleted.
Any suggestions?
Kind regards,
Hubert
I'm guessing you want to run sqlite as a memory database, at least that is my preferred test setup.
To achieve this, you have to setup your env in testing like so. Right now you had the connection as Mysql, this can not use the memory setting as sqlite.
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

ActionScript SmartFoxServer unable to connect

27.10.2014: I still really need help for this question.
My friend and I are trying to host a game through SmartFoxServer. He is hosting the server on his computer, and has successfully portforwarded the necessary port (9339) to his local IP. We have done everything in this guide. According to SmartFoxServer's feedback through the admin panel and the server terminal window, the hosting should be successful.
However, when trying to connect to his public IP, I get this error:
[WARN] Security Error: Error #2048: Security sandbox violation: file:
cannot load data from #IP#.
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" t-ports="*" secure="false" />
</cross-domain-policy>
config.xml
<ServerSetup>
<ServerIP>10.0.0.8</ServerIP>
<ServerPort>9339</ServerPort>
<AutoSendPolicyFile>true</AutoSendPolicyFile>
<MaxUserIdleTime>300</MaxUserIdleTime>
<!-- Server Variables limits (-1 = unlimited) -->
<MaxRoomVars>-1</MaxRoomVars>
<MaxUserVars>-1</MaxUserVars>
<AntiFlood active="false">
<MinMsgTime tolerance="5">1000</MinMsgTime>
<MaxRepeatedMessages>3</MaxRepeatedMessages>
<WarningsBeforeKick>2</WarningsBeforeKick>
<WarningMessage><![CDATA[No flooding allowed!)]]></WarningMessage>
<KickMessage><![CDATA[You've been warned! No flooding! Now you're kicked]]></KickMessage>
<BanMessage><![CDATA[Stop Flooding!! You're being banned]]></BanMessage>
<BanAfter timeSpan="1">3</BanAfter>
</AntiFlood>
<BadWordsFilter active="false">
<FilterMode>filter</FilterMode> <!-- REMOVE or FILTER -->
<StripCharacters><![CDATA[,.;:_!$%&/#*-+]]></StripCharacters>
<Warnings>true</Warnings>
<FilterRoomNames>true</FilterRoomNames>
<FilterUserNames>true</FilterUserNames>
<WarningsBeforeKick>3</WarningsBeforeKick>
<WarningMessage><![CDATA[No swearing!)]]></WarningMessage>
<KickMessage><![CDATA[You've been warned! No Swearing! Now you're kicked]]></KickMessage>
<BanMessage><![CDATA[Stop Swearing! You're being banned!]]></BanMessage>
<BanAfter timeSpan="1">3</BanAfter>
<BadWordsList>
<badWord>motherfucker</badWord>
<badWord>dickhead</badWord>
<badWord>asshole</badWord>
<badWord>shithead</badWord>
<badWord>shit</badWord>
<badWord>fucking</badWord>
<badWord>fuck</badWord>
<badWord>dickhead</badWord>
<badWord>bastard</badWord>
<badWord>nigger</badWord>
<badWord>idiot</badWord>
<badWord>bitch</badWord>
</BadWordsList>
</BadWordsFilter>
<BanCleaning>auto</BanCleaning>
<BanDuration>1800</BanDuration> <!-- 30 min -->
<BannedLoginMessage>You have been banned!</BannedLoginMessage>
<OutQueueThreads>1</OutQueueThreads>
<ExtHandlerThreads>1</ExtHandlerThreads>
<MaxWriterQueue>50</MaxWriterQueue>
<MaxIncomingQueue>8000</MaxIncomingQueue>
<DeadChannelsPolicy>strict</DeadChannelsPolicy>
<MaxMsgLen>4096</MaxMsgLen>
<LogMaxSize>5000000</LogMaxSize>
<LogMaxFiles>5</LogMaxFiles>
<!--
Available options are:
FINEST
FINER
FINE
CONFIG
INFO
WARNING
SEVERE
-->
<FileLoggingLevel>WARNING</FileLoggingLevel>
<ConsoleLoggingLevel>INFO</ConsoleLoggingLevel>
<AdminLogin>sfs_admin</AdminLogin>
<AdminPassword>sfs_pass</AdminPassword>
<AdminAllowedAddresses>
<AllowedAddress>*.*.*.*</AllowedAddress>
</AdminAllowedAddresses>
<IpFilter>0</IpFilter>
<!-- Enable / Disable remote zone info -->
<EnableZoneInfo>false</EnableZoneInfo>
</ServerSetup>
<!--
Zones Configuration.
-->
<Zones>
<Zone name="multiChat">
<Rooms>
<Room name="Main Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>
</Zones>
Actionscript 3 / Flash File
import flash.events.SecurityErrorEvent;
import flash.system.Security;
import it.gotoandplay.smartfoxserver.*
import flash.events.MouseEvent;
connect_btn.addEventListener(MouseEvent.CLICK, initiateConnection);
function initiateConnection(evt:MouseEvent):void
{
// ip_text.test = public IP address of server host machine
// int(port_text.text) = 9339
// zone_text.text = "multiChat"
// name_text.text = "testUser"
status_text.text = "Connecting to " + ip_text.text + "...";
var policyLoad:String = "xmlsocket://" + ip_text.text + ":" + port_text.text;
Security.loadPolicyFile(policyLoad)
var smartFox:SmartFoxClient = new SmartFoxClient(true)
smartFox.addEventListener(SecurityErrorEvent.SECURITY_ERROR, sandboxHandler)
smartFox.addEventListener(SFSEvent.onConnection, onConnectionHandler)
smartFox.connect(ip_text.text, int(port_text.text))
smartFox.addEventListener(SFSEvent.onLogin, onLoginHandler)
smartFox.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdateHandler)
smartFox.login(zone_text.text, name_text.text, "")
}
function onConnectionHandler(evt:SFSEvent):void
{
if (evt.params.success)
status_text.appendText("Connection successful \n");
else
status_text.appendText("Connection failed \n");
}
function onLoginHandler(evt:SFSEvent):void
{
if (evt.params.success)
status_text.appendText("Successfully logged in as " + evt.params.name + "\n");
else
status_text.appendText(status_text.text + "Zone login error; the following error occurred: " + evt.params.error + "\n");
}
function onRoomListUpdateHandler(evt:SFSEvent):void
{
// Dump the names of the available rooms in the "simpleChat" zone
for (var r:String in evt.params.roomList)
status_text.appendText(status_text.text + evt.params.roomList[r].getName() + "\n");
//smartFox.joinRoom(10)
}
function sandboxHandler(evt:SecurityErrorEvent):void
{
status_text.appendText("Sandbox Error / Flash Security Error Event");
}
Output:
*Attempting to launch and connect to Player using URL DIRECTORY OF FILE
[SWF] DIRECTORY OF FILE - 92561 bytes after decompression
[Sending]:
[WARN] Security Error: Error #2048: Security sandbox violation: file:DIRECTORY OF FILE cannot load data from PUBLIC HOST IP:9339.
[UnloadSWF] DIRECTORY OF FILE
Debug session terminated.
Debug session terminated.*
Change the following line:
<allow-access-from domain="*" t-ports="*"/>
to:
<allow-access-from domain="*" t-ports="*" secure="false" />
If still have some issue, you can check more details reading the official cross-domain policy documentation
Some useful URL's
SmartFoxServer configuration
SmartFox Forum
I regarded stackoverflow as one of the most reliable services in order to get help quickly, but this time I got the answer from somewhere else. I'll rewrite it here.
Maybe someone that has the same problem will consider this useful in the future.
The problem was after all quite simple. The standalone Adobe Flash Player automatically refuses such a connection. However it works when running it in a browser..
You had a typo in your policy file.
On line 4
<allow-access-from domain="*" t-ports="*" secure="false" />
Should have been
<allow-access-from domain="*" to-ports="*" secure="false" />
Note you had t-ports instead of to-ports.
Source: Cross-domain policy file specifications. https://www.adobe.com/content/dam/acom/en/devnet/articles/CrossDomain_PolicyFile_Specification.pdf#G3.344406

Loading image from another domain in flash

I have a flash application which is emded into an iframe, that is hosted on my domain (hc.ru). However, the swf file is situated at cs1234.vk.me and loads from there. The iframe is emded in the page which has the vk.com domain. In my flash application I want to load an image from domain cs4321.vk.me. When I test my flash app locally with local file it works just fine. Here is the code which loads the image:
_imgContainer = new Sprite();
var loader:Loader = new Loader();
_imgContainer.addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
loader.load(new URLRequest(url));
loader.mask = mc_holder;
private function onError(event:SecurityErrorEvent):void
{
trace("security error");
trace(event.text);
}
private function onLoaderComplete(event:Event):void
{
trace("the image was loaded");
this.addChild(_imgContainer);
}
When I upload the swf file to server and open it in browser it doesn't show me the image at all. However, there is no any kind of error thrown and trace output says "the image was loaded". All the cs****.vk.me servers, which contain both the swf file and the images, have the following crossdomain.xml file:
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-http-request-headers-from domain="vk.com" headers="*"/>
<allow-http-request-headers-from domain="*.vk.com" headers="*"/>
<allow-http-request-headers-from domain="userapi.com" headers="*"/>
<allow-http-request-headers-from domain="*.userapi.com" headers="*"/>
<allow-http-request-headers-from domain="vk.me" headers="*"/>
<allow-http-request-headers-from domain="*.vk.me" headers="*"/>
<allow-http-request-headers-from domain="vkontakte.ru" headers="*"/>
<allow-http-request-headers-from domain="*.vkontakte.ru" headers="*"/>
<allow-http-request-headers-from domain="mvkontakte.com" headers="*"/>
<allow-http-request-headers-from domain="*.mvkontakte.com" headers="*"/>
<allow-access-from domain="vk.com" to-ports="80"/>
<allow-access-from domain="*.vk.com" to-ports="80"/>
<allow-access-from domain="vk.me" to-ports="80"/>
<allow-access-from domain="*.vk.me" to-ports="80"/>
<allow-access-from domain="userapi.com" to-ports="80"/>
<allow-access-from domain="*.userapi.com" to-ports="80"/>
<allow-access-from domain="vkontakte.ru" to-ports="80"/>
<allow-access-from domain="*.vkontakte.ru" to-ports="80"/>
<allow-access-from domain="mvkontakte.com" to-ports="80"/>
<allow-access-from domain="*.mvkontakte.com" to-ports="80"/>
</cross-domain-policy>
I do not really get the problem, since there is no any error of some kind.
Thanks in advance.

How to deploy SQL Server Compact Edition 4.0?

How do i deploy Microsoft SQL Server Compact 4.0?
SQL Server Compact Edition (currently at version 4.0) is:
a free, embedded database that software developers can use for building Windows desktop applications. It has a small footprint and supports private deployment of its binaries within the application folder.
But how do you actually deploy it?
Microsoft says it can be deployed within the application folder (good) and supports xcopy deployment.
Microsoft also says it cannot be deployed within the application folder (bad), and does not support xcopy deployment.
some people have examples of it using simple xcopy deployment, but they don't go into the details required to complete the deployment
The problem is that you cannot use the ADO OLEdb provider unless it is registered. Registering an OLEdb provider has to be done as an administrator. That means that SQL Server Compact edition will fail with users who are not an administrator.
SQL Server Compact 4.0 comes with a redist_enu.txt file:
The listed .exe files each install its enclosed components to a specific location on the destination computer. This helps to ensure serviceability and technical support. The .dll files enclosed in these .exe files are also available separately in this redist.txt. However, distributions of these separate .dlls may result in issues of serviceability. For more details, please see http://go.microsoft.com/fwlink/?LinkId=94589
Private deployment detection via BreadCrumb: Private deployment of just the native stack and explicit loading of SQL Server Compact Assembly via Assembly.LoadFrom(), .local file, or the use of DLL/COM redirection strategies are not supported and may result in serviceability issues. For more information see http://support.microsoft.com/kb/835322 and http://msdn2.microsoft.com/en-us/library/aa375142.aspx
Microsoft SQL Server Compact 4.0
SSCERuntime_x86-ENU.exe
SSCERuntime_x86-DEU.exe
SSCERuntime_x86-FRA.exe
SSCERuntime_x86-JPN.exe
SSCERuntime_x86-RUS.exe
SSCERuntime_x86-ESN.exe
SSCERuntime_x86-ITA.exe
SSCERuntime_x86-KOR.exe
SSCERuntime_x86-CHT.exe
SSCERuntime_x86-CHS.exe
SSCERuntime_x64-ENU.exe
SSCERuntime_x64-DEU.exe
SSCERuntime_x64-FRA.exe
SSCERuntime_x64-JPN.exe
SSCERuntime_x64-RUS.exe
SSCERuntime_x64-ESN.exe
SSCERuntime_x64-ITA.exe
SSCERuntime_x64-KOR.exe
SSCERuntime_x64-CHT.exe
SSCERuntime_x64-CHS.exe
sqlcese40.dll
sqlceqp40.dll
sqlceoledb40.dll
sqlceca40.dll
sqlceme40.dll
sqlcecompact40.dll
sqlceer40en.dll
sqlceer40cn.dll/sqlceer40zh-CHS.dll
sqlceer40de.dll
sqlceer40es.dll
sqlceer40fr.dll
sqlceer40it.dll
sqlceer40ja.dll
sqlceer40ko.dll
sqlceer40tw.dll/sqlceer40zh-CHT.dll
sqlceer40ru.dll
System.Data.SqlServerCe.dll
System.Data.SqlServerCe.Entity.dll
but it doesn't give any information about how to redistribute SQL Server Compact 4.0.
Randomly spellunking around the undocumented Program Files folder i found 7 dlls:
C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\
sqlceoledb40.dll
sqlceqp40.dll
sqlcese40.dll
sqlceca40.dll
sqlcecompact40.dll
sqlceer40EN.dll
sqlceme40.dll
Note: There are also some child folders with more dlls
i tried copying these 7 dll's to a folder, and tried to open an ADO Connection using the connection string:
Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source="store.sdf"
but it fails with 0x80004005 Unspecified error
i tried frobbing the widget, but it grobbed the frobber.
i've created the solution.
SQL Server Compact Edition is comprised of 7 dlls:
sqlceme40.dll The undocumented, native, flat API library (The .net System.Data.SqlServerCe.dll assembly is a wrapper around this dll)
sqlceca40.dll A COM dll that implements Engine, Replication, Error and a few other COM objects
sqlceoledb40.dll A COM dll that implements an OLEdb provider for SSCE (allowing the use of ADO)
sqlcese40.dll unknown
sqlceqp40.dll unknown
sqlcecompact40.dll unknown
sqlceer40en.dll unknown
The problem with trying to simply ship these dlls is that two of them are COM objects. COM object dll's need to be registered, e.g.:
>regsvr32 sqlceca40.dll
>regsvr32 sqlceoledb40.dll
The problem is that registering a COM object requires administrative privileges (using a global solution to solve a local problem). This means that your users would
have to install your application (which you don't want to do)
requires your users to have administrative permissions (which you don't want to do)
Fortunately, starting in 2001 with Windows XP, Microsoft solved this COMmon problem: Registration-Free COM.
First, you will declare that your application has a "dependancy" on SQL Server Compact Edition 4.0. You do this by authoring an assembly manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="client"
type="win32"
/>
<description>Hyperion Pro</description>
<!-- We have a dependancy on SQL Server CE 4.0 -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.SQLSERVER.CE.4.0"
version="4.0.0.0" processorArchitecture="x86"
/>
</dependentAssembly>
</dependency>
<!-- We are high-dpi aware on Windows Vista -->
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<!-- We were designed and tested on Windows 7 -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows Vista -->
<!--supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/-->
</application>
</compatibility>
<!-- Disable file and registry virtualization -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
You can place this file beside your executable (as Hyperion.exe.manifest), or you can build it into your application as an RT_MANIFEST resource.
Notice that we have a dependancy against as assembly called Microsoft.SQLSERVER.CE.4.0. We create this assembly first by creating a directory called:
Microsoft.SQLSERVER.CE.4.0
When you deploy your application, you will place all 7 dll's that comprise this "assembly" into this Microsoft.SQLSERVER.CE.4.0 subfolder, along with a special .manifest file:
📁C:\
╰──📁Users
╰──📁Ian
╰──📁AppData
╰──📁Local
╰──📁Hyperion Pro
├──📄Hyperion.exe
├──📄Hyperion.exe.manifest
╰──📁Microsoft.SQLSERVER.CE.4.0
├──📄sqlceme40.dll
├──📄sqlceca40.dll
├──📄sqlceoledb40.dll
├──📄sqlcese40.dll
├──📄sqlceqp40.dll
├──📄sqlcecompact40.dll
├──📄sqlceer40en.dll
╰──📄Microsoft.SQLSERVER.CE.4.0.manifest
In other words, the application folder contains your application, and the Microsoft.SQLSERVER.CE.4.0 folder:
Directory of C:\Users\Ian\AppData\Local\Hyperion Pro
05/29/2012 09:23 AM 1,899,008 Hyperion.exe
05/28/2012 01:46 PM 1,587 Hyperion.exe.manifest
05/29/2012 09:27 AM <DIR> Microsoft.SQLSERVER.CE.4.0
2 File(s) 1,900,675 bytes
1 Dir(s) 20,851,503,104 bytes free
The next part of your task is to define the Microsoft.SQLSERVER.CE.4.0.manifest file. Registration-free COM allows a manifest file to declare all the COM objects and their clsid's. This took a lot of reverse engineering. But the assembly manifest for SQL Server Compact Edition 4.0 is:
Microsoft.SQLSERVER.CE.4.0.manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="Microsoft.SQLSERVER.CE.4.0"
processorArchitecture="x86"
version="4.0.0.0" />
<!-- OLEDB Provider -->
<file name = "sqlceoledb40.dll">
<comClass
description = "Microsoft SQL Server Compact OLE DB Provider for Windows"
clsid="{2006C53A-C915-41EA-BAA9-9EAB3A1FBF97}"
threadingModel = "Both"
progid = "Microsoft.SQLSERVER.CE.OLEDB.4.0" />
</file>
<!-- Native flat engine library -->
<file name="sqlceme40.dll" />
<!-- Engine and Replication COM object -->
<file name="sqlceca40.dll">
<comClass description="Active SSCE Engine Object"
clsid="{68D45319-3702-4837-9F8E-DA6845D82482}"
threadingModel="Both"
progid="SSCE.Engine.4.0" />
<comClass description="SSCE Error Object"
clsid="{36228F21-B5C7-4054-8DC2-47D3E236E8B5}"
threadingModel="Both"
progid="SSCE.Error.4.0" />
<comClass description="SSCE Param Object"
clsid="{0B3A7B75-A9B0-4580-9AA5-1A7DA47AD1CB}"
threadingModel="Both"
progid="SSCE.Param.4.0" />
<comClass description="Active SSCE Replication Object"
clsid="{11D5B2D4-26A4-44F5-A48B-0FAC3A919ED8}"
threadingModel="Both"
progid="SSCE.Replication.4.0" />
<comClass description="Active SSCE remote data access Object"
clsid="{58BC9AD6-BF11-40B3-9AB1-E3F2ED784C08}"
threadingModel="Both"
progid="SSCE.RemoteDataAccess.4.0" />
<typelib tlbid="{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}"
version="4.0"
helpdir=""/>
</file>
<comInterfaceExternalProxyStub
name="ISSCEEngine"
iid="{10EC3E45-0870-4D7B-9A2D-F4F81B6B7FA2}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCEError"
iid="{31155A3B-871D-407F-9F73-DEBFAC7EFBE3}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCERDA"
iid="{4F04F79D-1FF1-4DCD-802B-3D51B9356C14}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCEParams"
iid="{A78AFF90-049C-41EC-B1D8-665968AAC4A6}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCEParam"
iid="{A9876C60-2667-44E5-89DB-E9A46ED392C0}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCEErrors"
iid="{C40143CA-E9F9-4FF4-B8B4-CC02C064FC1B}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<comInterfaceExternalProxyStub
name="ISSCEMerge"
iid="{C6EB397F-D585-428D-A4F4-454A1842CB47}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
baseInterface="{00000000-0000-0000-C000-000000000046}"
tlbid = "{CE4AACFA-3CFD-4028-B2D9-F272314F07C8}" />
<file name="sqlceqp40.dll" />
<file name="sqlcese40.dll" />
<file name="sqlcecompact40.dll" />
<file name="sqlceer40EN.dll" />
</assembly>
The a final gotcha is that, in the same way we have a dependancy on an assembly called Microsoft.SQLSERVER.CE.4.0, SQL Server Compact Edition 4.0 in turn has a dependancy on an assembly called Microsoft.VC90.CRT. Fortunately your install of SQLCE ships with a copy of this assembly:
📁Microsoft.VC90.CRT
├──📄Microsoft.VC90.CRT.manifest
╰──📄msvcr90.dll
This means the final directory structure is:
📁C:\
╰──📁Users
╰──📁Ian
╰──📁AppData
╰──📁Local
╰──📁Hyperion Pro
├──📄Hyperion.exe
├──📄Hyperion.exe.manifest
╰──📁Microsoft.SQLSERVER.CE.4.0
├──📄Microsoft.SQLSERVER.CE.4.0.manifest
├──📄sqlceme40.dll
├──📄sqlceca40.dll
├──📄sqlceoledb40.dll
├──📄sqlcese40.dll
├──📄sqlceqp40.dll
├──📄sqlcecompact40.dll
├──📄sqlceer40en.dll
╰──📁Microsoft.VC90.CRT
├──📄Microsoft.VC90.CRT.manifest
╰──📄msvcr90.dll
For Sql Server Ce 4.0 SP1:
Instead of tackling all the gritty stuff of deployment, I just opted to include the setup files themselves into my exe as EmbeddedResource and did this little helper:
public static class RedistHelper
{
private static readonly ILog Log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string SqlCeRedistName64 = "SSCERuntime_x64-ENU.exe";
private static readonly string SqlCeRedistName32 = "SSCERuntime_x86-ENU.exe";
private static readonly Dictionary<string, Assembly> Assemblies =
new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
private static string SqlCeRedistName
{
get
{
return Environment.Is64BitOperatingSystem
? SqlCeRedistName64
: SqlCeRedistName32;
}
}
public static bool IsSqlCeInstalled()
{
RegistryKey localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine,
RegistryView.Registry64);
RegistryKey ret = localKey.OpenSubKey(
#"SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU");
return ret != null;
}
private static byte[] ReadFully(Stream input)
{
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
ms.Write(buffer, 0, read);
return ms.ToArray();
}
}
public static Assembly OnCurrentDomainOnAssemblyResolve(object sender,
ResolveEventArgs args)
{
Assembly dll;
var name = new AssemblyName(args.Name).Name + ".dll";
if (!Assemblies.TryGetValue(name, out dll))
{
Assembly res = typeof(RedistHelper).Assembly;
using (Stream input =
res.GetManifestResourceStream(typeof(RedistHelper), name))
{
if (input == null)
{
Log.WarnFormat("Assembly {0} does not contain {1}", res, name);
return null;
}
dll = Assembly.Load(ReadFully(input));
if (dll == null)
{
Log.WarnFormat("Assembly {0} failed to load.", name);
return null;
}
Log.InfoFormat("Loaded assembly {0}.", name);
Assemblies[name] = dll;
return dll;
}
}
return dll;
}
public static void InstallSqlCe()
{
using (Stream stream =
typeof(RedistHelper).Assembly.GetManifestResourceStream(
typeof(RedistHelper), SqlCeRedistName))
{
Debug.Assert(stream != null);
byte[] bytes = new byte[(int)stream.Length];
stream.Read(bytes, 0, bytes.Length);
string path = Path.Combine(Path.GetTempPath(), SqlCeRedistName);
if (File.Exists(path))
File.Delete(path);
File.WriteAllBytes(path, bytes);
Process process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = path,
UseShellExecute = true
}
};
process.Start();
process.WaitForExit();
}
}
}
The only thing that really gave me a headache was referencing the System.Data.SqlServerCe.dll - it simply wouldnt IlMerge, so instead I loaded it on demand, in my main:
AppDomain.CurrentDomain.AssemblyResolve += RedistHelper.OnCurrentDomainOnAssemblyResolve;
Not sure if something changed or not. But with the latest SQL Server CE nuget package, the application manifests are no longer needed. You will get two sets of binaries: x86, and amd64. Just copy them to your target folder under x86 and/or amd64 sub directory.
|--Your App Dir
|--x86 (x86 sql ce binaries)
|--amd64 (amd64 sql ce binaries)
And you're good to go. Looks like the System.Data.SqlCe.dll can automatically find and load the native binaries. You can also deploy them in the app dir if your app is only targeted for one platform.

AS3 loader causes securityError #2044 despite crossdomain.xml

I'm working on a online painting application.
The application swf as well as the backend server is located here:
http://217.150.244.137/Client.swf
there is a crossdomain.xml located in the root as well:
http://217.150.244.137/crossdomain.xml
I load the canvas images from the server like this:
var _loader:Loader = new Loader();
//make sure it's really not comming from the cache
var urlRequest:URLRequest = new URLRequest(url+'?nocache=' + new Date().getTime());
var requestHeader1:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
var requestHeader2:URLRequestHeader = new URLRequestHeader("Expires", "Thu, 01 Jan 1970 00:00:00 GMT, -1");
var requestHeader3:URLRequestHeader = new URLRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate");
urlRequest.requestHeaders.push(requestHeader1);
urlRequest.requestHeaders.push(requestHeader2);
urlRequest.requestHeaders.push(requestHeader3);
var context:LoaderContext = new LoaderContext(true);
_loader.load(urlRequest, context);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onDataLoaded);
Still, the swf doesn't work when embeeded from another page
i get a
Error #2044: SecurityErrorEvent unverarbeitet. text=Error #2170: Verletzung der Sicherheits-Sandbox: http://www.pictonauts.theaterspektakel.ch/Client.swf kann keine HTTP-Header an http://217.150.244.137/images/wall/4/img_-2_-1_4.jpg?nocache=1331058396137 senden.
What am I missing or doing wrong?
First, try this crossdomain.xml:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false" />
<allow-http-request-headers-from domain="*" headers="*" secure="false" />
</cross-domain-policy>