https://wiki.mdriven.net/api.php?action=feedcontributions&user=Henrik&feedformat=atomMDrivenWiki - User contributions [en]2024-03-28T23:14:58ZUser contributionsMediaWiki 1.39.4https://wiki.mdriven.net/index.php?title=Documentation:Rest_Services_In_MDriven&diff=13155Documentation:Rest Services In MDriven2023-01-11T16:20:06Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use postman-echo.com [https://postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Rest_Services_In_MDriven&diff=7805Training:Rest Services In MDriven2023-01-11T16:20:06Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use postman-echo.com [https://postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Rest_Services_In_MDriven&diff=13154Documentation:Rest Services In MDriven2023-01-11T16:19:38Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [postman-echo.com[https://postman-echo.com]] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Rest_Services_In_MDriven&diff=7804Training:Rest Services In MDriven2023-01-11T16:19:38Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [postman-echo.com[https://postman-echo.com]] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Rest_Services_In_MDriven&diff=13153Documentation:Rest Services In MDriven2023-01-11T16:18:49Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [https://postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Rest_Services_In_MDriven&diff=7803Training:Rest Services In MDriven2023-01-11T16:18:49Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [https://postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Rest_Services_In_MDriven&diff=13152Documentation:Rest Services In MDriven2023-01-11T16:17:50Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Rest_Services_In_MDriven&diff=7802Training:Rest Services In MDriven2023-01-11T16:17:50Z<p>Henrik: </p>
<hr />
<div>'''REST services''' are services that are executed by connecting to an URL that defines operation and parameters then it returns an answer – not seldom as JSon objects.<br />
<br />
You must set the tagged value '''RestAllowed''' on ViewModels you want to allow Rest access to.<br />
<br />
=== '''Calling existing REST services''' ===<br />
MDriven supports a couple of EAL operators to manage REST services. All operators reside on the [[selfVM]] variable – available only in the ViewModel context.<br />
''selfVM.RestGet(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestGet]]<br />
''selfVM.RestPost(targeturl,user,pwd,optionalnestingwithheadersAndUploadValues)''<br />
Read: [[OCLOperators RestPost]]<br />
''selfVM.RestDownload(targeturl,user,pwd,optionalnestingwithheaders)''<br />
Read: [[OCLOperators RestDownload]]<br />
<br />
'''Note!''' ''optionalnestingwithheaders'' is the '''name''' of the blue view model class in the example below (as a OCL String).<br />
<br />
==== Example ====<br />
[[File:2018-05-29 10h31 45.png|none|thumb|689x689px]]<br />
The action '''GetExporttest''' retrieves data by converting another viewmodel to xml - it stores it in the variable vText<br />
<br />
Next action invokes RestPost to send that data to an url-address, it also says that it should look at the nesting named 'Xml' - in this nesting we have the STRINGCONTENT (see also [[OCLOperators RestPost]]) which get's it's content from the vText variable - we also add the header Authorization with a bearer token in order to get access from the receiving service.<br />
<br />
=== Exposing ourselves as a REST service ===<br />
And when it comes to '''exposing ourselves to others''' – Turnkey has two MVC verbs, Get and Post, like this;<br />
TurnkeyRest/Get?command=vmname&id=rootobjref<br />
<br />
TurnkeyRest/Post?command=vmname&id=rootobjref<br />
See [[Improved routes]] for another URLs. <br />
<br />
The ViewModel name is supplied as the '''command''' parameter. <br />
<br />
The '''id''' parameter is an object reference in one of several available formats. Read more [[The ExternalId explained|here]] about how to create these. <br />
<br />
'''Caution''': Always send a complete id, i.e. a guid or '''xx|yyyy'''. Using a shortcut without class identifier can cause problems. <br />
<br />
Note that the variables set in your viewmodel has to be of the '''String''' type. <br />
<br />
===== The commands does this; =====<br />
We check that the tagged value '''RestAllowed''' has been set on the viewmodel, then we look up the root object. <br />
<br />
When the viewmodel and it's root has been found and the [http://wiki.mdriven.net/index.php/Part_9_MDriven_Turnkey,_cloud_tools_and_access_groups accessgroups] are checked to see if access is allowed.<br />
<br />
Then additional parameters are set (these can be either URL Encoded or multi-part form encoded. [https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST See HTTP POST] for details).<br />
* For Get, the parameter names are looked up against ViewModel variables and variable values are set. <br />
* For Post, the parameter names are looked up against ViewModel variables '''and''' '''attributes''' and values are set.<br />
Then any actions present at the root level of the ViewModel are executed, ''in the order presented in the viewmodel'' from top to bottom.<br />
* For Get, use the actions to look up additional information.<br />
* For Post, the actions are usually used to process sent JSON data into objects (see below)<br />
Post saves any changed values to the database.<br />
<br />
Both Get and Post returns the viewmodel content as JSON in the HTTP response. To override this use 1 one these strategies: <br />
# add a string attribute named exactly RawJSon on the root - if found this is returned instead of the complete vm as json. <br />
# add a vReturnMessage:String variable as described further down on this page<br />
If there is an error – a string “error: <message>” is returned.<br />
<br />
If you need to receive post data not known at design time please read [[Receive post data not known at design time]]. <br />
<br />
You may [[Use c-sharp code to post to TurnkeyRest|use c# code to post to TurnkeyRest]]. <br />
<br />
===== Processing JSON into objects =====<br />
If you want to send data as JSON in a POST you need to apply the JSON string to your systems modelled objects.<br />
<br />
Use [[Tajson]] or the simpler JsonToObjects. Read more here on XML or JSON support: [[Import xml and JSon with MDriven]]<br />
<br />
The selfVM.JSonToObjects creates objects with the root in a of class and matches attributes and association from the JSON data – and it can create object trees (unclosed graphs) by following names on associations.<br />
selfVM.JSonToObjects( «<Type>» , JSonDataInStringFormat)<br />
You can use an existing JSON as a template to create a model section that you can import into, see [[Using JSON or XML as class template|Using JSON or XML as class template.]]<br />
<br />
=== Video ===<br />
<br />
<html><br />
<p class="warn"><br />
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme navigation-itemplace in the<br />
video. Now you can pick any topic to be instructed without watching the whole video.</em><br />
</p><br />
<br><br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/rv31ziYXWME?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="10" tabindex="0"> What is REST? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="82" tabindex="0"> How does it work with MDriven turnkey? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="125" tabindex="0"> calling an existing REST service </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="191" tabindex="0"> exposing ourself as REST service </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="244" tabindex="0"> MDriven turnkey app slot </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="333" tabindex="0"> how to expose information as the Rest service? </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="450" tabindex="0"> MDriven Rest/get strategy </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="573" tabindex="0"> how to consume data? </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="680" tabindex="0"> selfvm </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="716" tabindex="0"> Rest/Get operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="925" tabindex="0"> hard-coded objects </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1336" tabindex="0"> Json to objects operator </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1784" tabindex="0"> update data with allow post </span><br />
<br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="1898" tabindex="0"> RestPost operator as a post command </span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2490" tabindex="0"> operation execution</span><br />
<span class="navigation-item" data-video="rv31ziYXWME" data-start="2558" tabindex="0"> vSomeParam adding new parameters </span><br />
<br />
<br />
</div><br />
</div><br />
<br />
</html><br />
<br />
=== Return Status codes, and override returned data ===<br />
New from 2020-12-09 you can now override return result data and code by declaring variables in your RestAllowed ViewModel:<br />
<br />
vReturnMessage:String<br />
vReturnStatusCode:String<br />
The vReturnMessage (reason code) must be found and will be returned as content instead of the default (to make json of the viewmodel) - the return message will have the status code of vReturnStatusCode<br />
<br />
If the vReturnStatusCode is found it must have one of the values defined here: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0 otherwise 200 "Ok" is returned. We will parse the string value with this logic:<br />
realstatuscode = (System.Net.HttpStatusCode)System.Net.HttpStatusCode.Parse(typeof(System.Net.HttpStatusCode), (string)(returnstatuscode.AsObject), true); <br />
<br />
This means the action code can look like this: <br />
<br />
vReturnStatusCode:='NotFound' or vReturnStatusCode:='Created' etc<br />
<br />
=== Read status code from RestPost, RestGet etc ===<br />
Use the vReturnStatusCode:string variable name to get Status from quering others with rest - RestPost, RestGet etc.<br />
<br />
Use the vReturnMessage:string variable name to get the reasoncode from other with rest.<br />
<br />
=== Receive string content ===<br />
We assume postback data as FormFields that we match to ViewModelColumns. If someone posts string content (no form data) we now put that data in column named "STRINGCONTENT" if found.<br />
<br />
== Debugging ==<br />
It may sometimes be time consuming to get all the parameters correct when forming a request. A tips is to use [postman-echo.com] to better understand what is actually sent.<br />
<br />
[[Category:Rest]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Cannot_insert_duplicate_key_row_in_object&diff=6981Documentation:Cannot insert duplicate key row in object2022-09-01T11:22:50Z<p>Henrik: Created page with "This error from SQL Server is commonly shown when you try to assign a singlelink with a new link. The workaround is to save the link after assigning it a nullvalue before assi..."</p>
<hr />
<div>This error from SQL Server is commonly shown when you try to assign a singlelink with a new link. The workaround is to save the link after assigning it a nullvalue before assigning it to the new link. This problem mainly exists using SQL server.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:AppPool_user&diff=6980Documentation:AppPool user2022-08-30T09:38:25Z<p>Henrik: </p>
<hr />
<div>When running Turnkey you will want to make sure that the user running the IIS Turnkey application and the IIS MDriven Server application has access to the file system.<br />
You do this by allowing the local user "IIS APPPOOL\{app pool name}" full control (create directories) access to the application root.<br />
<br />
If you do not want to allow full control to the application root. The following may be an alternative<br />
<br />
'''AppData''' - full control at application installation. You may limit to read/write access after installation and model upload is done.<br />
<br />
'''Logs''' - read/write access <br />
<br />
'''ModeCodeAssemblies''' - only used for CodeDress<br />
<br />
This applies both for MDrivenServer and Turnkey<br />
<br />
This is particulare important when using [[CodeDress]] - since the assemblies need to be copied<br />
[[Category:MDriven Server]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:AppPool_user&diff=6979Documentation:AppPool user2022-08-30T09:38:14Z<p>Henrik: </p>
<hr />
<div>When running Turnkey you will want to make sure that the user running the IIS Turnkey application and the IIS MDriven Server application has access to the file system.<br />
You do this by allowing the local user "IIS APPPOOL\{app pool name}" full control (create directories) access to the application root.<br />
<br />
If you do not want to allow full control to the application root. The following may be an alternative<br />
<br />
'''AppData''' - full control at application installation. You may limit to read/write access after installation and model upload is done.<br />
<br />
'''Logs''' - read/write access <br />
'''ModeCodeAssemblies''' - only used for CodeDress<br />
<br />
This applies both for MDrivenServer and Turnkey<br />
<br />
This is particulare important when using [[CodeDress]] - since the assemblies need to be copied<br />
[[Category:MDriven Server]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:AppPool_user&diff=6978Documentation:AppPool user2022-08-30T09:37:57Z<p>Henrik: </p>
<hr />
<div>When running Turnkey you will want to make sure that the user running the IIS Turnkey application and the IIS MDriven Server application has access to the file system.<br />
You do this by allowing the local user "IIS APPPOOL\{app pool name}" full control (create directories) access to the application root.<br />
<br />
If you do not want to allow full control to the application root. The following may be an alternative<br />
<br />
'''AppData''' - full control at application installation. You may limit to read/write access after installation and model upload is done. <br />
'''Logs''' - read/write access <br />
'''ModeCodeAssemblies''' - only used for CodeDress<br />
<br />
This applies both for MDrivenServer and Turnkey<br />
<br />
This is particulare important when using [[CodeDress]] - since the assemblies need to be copied<br />
[[Category:MDriven Server]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:MDrivenServer,_serverside_environment_variables&diff=6974Training:MDrivenServer, serverside environment variables2022-08-23T13:22:09Z<p>Henrik: </p>
<hr />
<div>Variables defined by the MDrivenServer when running serverside jobs.<br />
<br />
If you want serverside jobs to know which server it's running on, use server defined variables as in the example below.<br />
<br />
[[File:2020-02-03 09h16 56.png|none|thumb|584x584px]]<br />
Then you want to do logic in your serverside job that behaves differently depending on if you are in production or development:<br />
[[File:2020-02-03 09h20 59.png|none|thumb|504x504px]]<br />
There's nothing special with the variables themselves, more than that they are defined on a per server basis.<br />
<br />
You can use any variable in MDrivenServer and pick up the setting when serverside jobs run just by having a matching definition.<br />
That is you need to declare the variables (again) in your ViewModel[[Category:MDriven Server]]<br />
[[Category:Serverside jobs]]<br />
[[Category:Advanced]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:WSL_Windows_subsystem_for_Linux&diff=6842Documentation:WSL Windows subsystem for Linux2022-06-29T15:06:19Z<p>Henrik: </p>
<hr />
<div>To get started with Linux you may use WSL. WSL is the Windows SubSystem for Linux that is built into Windows10.<br />
<br />
Make sure you have the feature on ; Turn windows features on or off -> Windows Subsystem for Linux<br />
<br />
Once you have it on you need a Linux install; we use Ubuntu (22.04 at the time of writing)<br />
wget <nowiki>https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb</nowiki> -O packages-microsoft-prod.deb<br />
sudo dpkg -i packages-microsoft-prod.deb<br />
You then install .net core (we use .net core 5.0)<br />
sudo apt-get update; \ <br />
sudo apt-get install -y apt-transport-https && \<br />
sudo apt-get update && \<br />
sudo apt-get install -y dotnet-sdk-5.0<br />
This is a good overview: https://weblog.west-wind.com/posts/2017/apr/13/running-net-core-apps-under-windows-subsystem-for-linux-bash-for-windows<br />
<br />
Remember that your c disk is found here /mnt/c/<br />
<br />
====== WSL2 ======<br />
WSL2 offers better interaction between Visual Studio and WSL; read more here https://docs.microsoft.com/en-us/visualstudio/debugger/debug-dotnet-core-in-wsl-2?view=vs-2019<br />
<br />
Had to install the “.Net Core Debugging with WSL 2” component in Visual Studio Installer (Visual Studio Edition->Modify->Individual Components->.Net Core Debugging with WSL 2<br />
<br />
====== Build MDrivenServer ======<br />
You need to register a nuget package source to find the VistaDB packages not available on nuget site, this is needed only once:<br />
sudo dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name XternatVistaDB <br />
Build the a sln; navigate to the directory, then: <br />
sudo dotnet build<br />
To start MDrivenServer project, navigate to directory: <br />
sudo dotnet run -port=5001 -nohttps -host=ip/domain<br />
<br />
====== What issues have been identified on MDrivenServer: ======<br />
# CompactCE is a windows only embedded database - we are looking to replace with a license version of VistaDB. If file App_Data/UseVistaDBIfThisFileExists.xml exists we will now use VistaDB instead of CompactCE<br />
# All backslashes in filepaths replaced with Path.DirectorySeparatorChar<br />
# CompactCE connection reads registry and fails on WSL<br />
# Model checksum is built on modelcontent with a stringbuilder that use \r\n on windows and \n on linux - causing checksum diff<br />
# Issues with localhost cert forces all tests to be done over http<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdrivenserverport" - if found we use it over http<br />
<br />
====== Issues on Turnkey: ======<br />
# Path.DirectorySeparatorChar<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdriventurnkeyport" - if found we use it over http<br />
<br />
=== Deploy on linux ===<br />
The deploy on linux works much the same as described in the [[LocalServers]] description. The reason is that Linux and LocalServers both use the same .net core editions of MDrivenTurnkey and MDrivenServer.<br />
<br />
Dlls are platform independant - but exe's are not: https://docs.microsoft.com/en-us/dotnet/core/deploying/ - this leads to a separate publish being needed to get the linux distribution:<br />
dotnet publish -r linux-x64 --self-contained false<br />
You can download the Linux distributions from here:<br />
<br />
[https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux__ https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux_]<version>.zip.<br />
<br />
The current version is found here https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml<br />
<br />
https://mdriven.net/PublicDownloads/MDrivenTurnkeyCoreLinux_<version>.zip.<br />
<br />
The current version is found here [https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml https://mdriven.net/PublicDownloads/MDrivenTurnkeyOnCoreVersion.xml]<br />
<br />
You download the server-zip's as described above. In these 2 zips you will find StreaminAppCoreWebApp.dll (TurnkeyServer as dll), and AppCompleteGenericCore.dll (MDrivenServer as dll).<br />
<br />
Expand the zips to your desired locations on linux - in two different directories.<br />
<br />
====== Starting on Linux ======<br />
In order to start the applications you need to install at least dotnet core 3.1 on your linux machine<br />
<br />
You need to configure [https://wiki.mdriven.net/index.php/MDrivenServerOverride MDrivenServerOverride] to set the adress and port to MDriven Server<br />
<br />
Start the applications - MDrivenServer first by navigating to the directory of the app and: <br />
dotnet AppCompleteGenericCore.dll -port=5010 -nohttps<br />
Then navigate to the TurnkeyApp directory and:<br />
dotnet StreaminAppCoreWebApp.dll -port=5011 -nohttps<br />
[[File:2021-05-18 15h34 54.png|none|thumb|626x626px]]<br />
After start you can navigate to the MDrivenServer by using the chosen url - you can log in with user a and pwd 123456<br />
<br />
The MDrivenServer does not yet have a model - you [[Upload model in MDrivenDesigner|upload a model with MDrivenDesigner]] - after this step you can run the application in the MDrivenTurnkey.<br />
<br />
<br />
<br />
====== Tips and Tricks ======<br />
This is no Linux-expert-wiki - but I noticed that the WorkInfo page of MDrivenServer ran into problems while creating bitmaps. It turned out that there was some graphics lib missing on the server, the following fixed it:<br />
sudo apt-get install libgdiplus <br />
cd /usr/lib <br />
sudo ln -s libgdiplus.so gdiplus.dll</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:WSL_Windows_subsystem_for_Linux&diff=6841Documentation:WSL Windows subsystem for Linux2022-06-29T15:05:20Z<p>Henrik: </p>
<hr />
<div>To get started with Linux you may use WSL. WSL is the Windows SubSystem for Linux that is built into Windows10.<br />
<br />
Make sure you have the feature on ; Turn windows features on or off -> Windows Subsystem for Linux<br />
<br />
Once you have it on you need a Linux install; we use Ubuntu (22.04 at the time of writing)<br />
wget <nowiki>https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb</nowiki> -O packages-microsoft-prod.deb<br />
sudo dpkg -i packages-microsoft-prod.deb<br />
You then install .net core (we use .net core 5.0)<br />
sudo apt-get update; \ <br />
sudo apt-get install -y apt-transport-https && \<br />
sudo apt-get update && \<br />
sudo apt-get install -y dotnet-sdk-5.0<br />
This is a good overview: https://weblog.west-wind.com/posts/2017/apr/13/running-net-core-apps-under-windows-subsystem-for-linux-bash-for-windows<br />
<br />
Remember that your c disk is found here /mnt/c/<br />
<br />
====== WSL2 ======<br />
WSL2 offers better interaction between Visual Studio and WSL; read more here https://docs.microsoft.com/en-us/visualstudio/debugger/debug-dotnet-core-in-wsl-2?view=vs-2019<br />
<br />
Had to install the “.Net Core Debugging with WSL 2” component in Visual Studio Installer (Visual Studio Edition->Modify->Individual Components->.Net Core Debugging with WSL 2<br />
<br />
====== Build MDrivenServer ======<br />
You need to register a nuget package source to find the VistaDB packages not available on nuget site, this is needed only once:<br />
sudo dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name XternatVistaDB <br />
Build the a sln; navigate to the directory, then: <br />
sudo dotnet build<br />
To start MDrivenServer project, navigate to directory: <br />
sudo dotnet run -port=5001 -nohttps -host=ip/domain<br />
<br />
====== What issues have been identified on MDrivenServer: ======<br />
# CompactCE is a windows only embedded database - we are looking to replace with a license version of VistaDB. If file App_Data/UseVistaDBIfThisFileExists.xml exists we will now use VistaDB instead of CompactCE<br />
# All backslashes in filepaths replaced with Path.DirectorySeparatorChar<br />
# CompactCE connection reads registry and fails on WSL<br />
# Model checksum is built on modelcontent with a stringbuilder that use \r\n on windows and \n on linux - causing checksum diff<br />
# Issues with localhost cert forces all tests to be done over http<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdrivenserverport" - if found we use it over http<br />
<br />
====== Issues on Turnkey: ======<br />
# Path.DirectorySeparatorChar<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdriventurnkeyport" - if found we use it over http<br />
<br />
=== Deploy on linux ===<br />
The deploy on linux works much the same as described in the [[LocalServers]] description. The reason is that Linux and LocalServers both use the same .net core editions of MDrivenTurnkey and MDrivenServer.<br />
<br />
Dlls are platform independant - but exe's are not: https://docs.microsoft.com/en-us/dotnet/core/deploying/ - this leads to a separate publish being needed to get the linux distribution:<br />
dotnet publish -r linux-x64 --self-contained false<br />
You can download the Linux distributions from here:<br />
<br />
[https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux__ https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux_]<version>.zip.<br />
<br />
The current version is found here https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml<br />
<br />
https://mdriven.net/PublicDownloads/MDrivenTurnkeyCoreLinux_<version>.zip.<br />
<br />
The current version is found here [https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml https://mdriven.net/PublicDownloads/MDrivenTurnkeyOnCoreVersion.xml]<br />
<br />
You download the server-zip's as described above. In these 2 zips you will find StreaminAppCoreWebApp.dll (TurnkeyServer as dll), and AppCompleteGenericCore.dll (MDrivenServer as dll).<br />
<br />
Expand the zips to your desired locations on linux - in two different directories.<br />
<br />
====== Starting on Linux ======<br />
In order to start the applications you need to install at least dotnet core 3.1 on your linux machine<br />
<br />
Start the applications - MDrivenServer first by navigating to the directory of the app and: <br />
dotnet AppCompleteGenericCore.dll -port=5010 -nohttps<br />
Then navigate to the TurnkeyApp directory and:<br />
dotnet StreaminAppCoreWebApp.dll -port=5011 -nohttps<br />
[[File:2021-05-18 15h34 54.png|none|thumb|626x626px]]<br />
After start you can navigate to the MDrivenServer by using the chosen url - you can log in with user a and pwd 123456<br />
<br />
The MDrivenServer does not yet have a model - you [[Upload model in MDrivenDesigner|upload a model with MDrivenDesigner]] - after this step you can run the application in the MDrivenTurnkey.<br />
<br />
You need to configure [https://wiki.mdriven.net/index.php/MDrivenServerOverride MDrivenServerOverride] to set the adress and port to MDriven Server<br />
<br />
====== Tips and Tricks ======<br />
This is no Linux-expert-wiki - but I noticed that the WorkInfo page of MDrivenServer ran into problems while creating bitmaps. It turned out that there was some graphics lib missing on the server, the following fixed it:<br />
sudo apt-get install libgdiplus <br />
cd /usr/lib <br />
sudo ln -s libgdiplus.so gdiplus.dll</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:WSL_Windows_subsystem_for_Linux&diff=6840Documentation:WSL Windows subsystem for Linux2022-06-29T14:25:22Z<p>Henrik: </p>
<hr />
<div>To get started with Linux you may use WSL. WSL is the Windows SubSystem for Linux that is built into Windows10.<br />
<br />
Make sure you have the feature on ; Turn windows features on or off -> Windows Subsystem for Linux<br />
<br />
Once you have it on you need a Linux install; we use Ubuntu (22.04 at the time of writing)<br />
wget <nowiki>https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb</nowiki> -O packages-microsoft-prod.deb<br />
sudo dpkg -i packages-microsoft-prod.deb<br />
You then install .net core (we use .net core 5.0)<br />
sudo apt-get update; \ <br />
sudo apt-get install -y apt-transport-https && \<br />
sudo apt-get update && \<br />
sudo apt-get install -y dotnet-sdk-5.0<br />
This is a good overview: https://weblog.west-wind.com/posts/2017/apr/13/running-net-core-apps-under-windows-subsystem-for-linux-bash-for-windows<br />
<br />
Remember that your c disk is found here /mnt/c/<br />
<br />
====== WSL2 ======<br />
WSL2 offers better interaction between Visual Studio and WSL; read more here https://docs.microsoft.com/en-us/visualstudio/debugger/debug-dotnet-core-in-wsl-2?view=vs-2019<br />
<br />
Had to install the “.Net Core Debugging with WSL 2” component in Visual Studio Installer (Visual Studio Edition->Modify->Individual Components->.Net Core Debugging with WSL 2<br />
<br />
====== Build MDrivenServer ======<br />
You need to register a nuget package source to find the VistaDB packages not available on nuget site, this is needed only once:<br />
sudo dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name XternatVistaDB <br />
Build the a sln; navigate to the directory, then: <br />
sudo dotnet build<br />
To start MDrivenServer project, navigate to directory: <br />
sudo dotnet run -port=5001 -nohttps -host=ip/domain<br />
<br />
====== What issues have been identified on MDrivenServer: ======<br />
# CompactCE is a windows only embedded database - we are looking to replace with a license version of VistaDB. If file App_Data/UseVistaDBIfThisFileExists.xml exists we will now use VistaDB instead of CompactCE<br />
# All backslashes in filepaths replaced with Path.DirectorySeparatorChar<br />
# CompactCE connection reads registry and fails on WSL<br />
# Model checksum is built on modelcontent with a stringbuilder that use \r\n on windows and \n on linux - causing checksum diff<br />
# Issues with localhost cert forces all tests to be done over http<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdrivenserverport" - if found we use it over http<br />
<br />
====== Issues on Turnkey: ======<br />
# Path.DirectorySeparatorChar<br />
# Issues with sending parameters via WSL2-VS-Start ; workaround: program checks for environmentvariable "mdriventurnkeyport" - if found we use it over http<br />
<br />
=== Deploy on linux ===<br />
The deploy on linux works much the same as described in the [[LocalServers]] description. The reason is that Linux and LocalServers both use the same .net core editions of MDrivenTurnkey and MDrivenServer.<br />
<br />
Dlls are platform independant - but exe's are not: https://docs.microsoft.com/en-us/dotnet/core/deploying/ - this leads to a separate publish being needed to get the linux distribution:<br />
dotnet publish -r linux-x64 --self-contained false<br />
You can download the Linux distributions from here:<br />
<br />
[https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux__ https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux_]<version>.zip.<br />
<br />
The current version is found here https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml<br />
<br />
https://mdriven.net/PublicDownloads/MDrivenTurnkeyCoreLinux_<version>.zip.<br />
<br />
The current version is found here [https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml https://mdriven.net/PublicDownloads/MDrivenTurnkeyOnCoreVersion.xml]<br />
<br />
You download the server-zip's as described above. In these 2 zips you will find StreaminAppCoreWebApp.dll (TurnkeyServer as dll), and AppCompleteGenericCore.dll (MDrivenServer as dll).<br />
<br />
Expand the zips to your desired locations on linux - in two different directories.<br />
<br />
====== Starting on Linux ======<br />
In order to start the applications you need to install at least dotnet core 3.1 on your linux machine<br />
<br />
Start the applications - MDrivenServer first by navigating to the directory of the app and: <br />
dotnet AppCompleteGenericCore.dll -port=5010 -nohttps<br />
Then navigate to the TurnkeyApp directory and:<br />
dotnet StreaminAppCoreWebApp.dll -port=5011 -nohttps<br />
[[File:2021-05-18 15h34 54.png|none|thumb|626x626px]]<br />
After start you can navigate to the MDrivenServer by using the chosen url - you can log in with user a and pwd 123456<br />
<br />
The MDrivenServer does not yet have a model - you [[Upload model in MDrivenDesigner|upload a model with MDrivenDesigner]] - after this step you can run the application in the MDrivenTurnkey.<br />
<br />
====== Tips and Tricks ======<br />
This is no Linux-expert-wiki - but I noticed that the WorkInfo page of MDrivenServer ran into problems while creating bitmaps. It turned out that there was some graphics lib missing on the server, the following fixed it:<br />
sudo apt-get install libgdiplus <br />
cd /usr/lib <br />
sudo ln -s libgdiplus.so gdiplus.dll</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SignalR_and_Realtime&diff=6526Documentation:SignalR and Realtime2021-11-04T16:26:55Z<p>Henrik: </p>
<hr />
<div>==== What is SignalR and what is it used for ====<br />
SignalR is a .net software componenent used for Realtime communication. By realtime we mean that communication done point to point at the time of need.<br />
<br />
==== How is realtime communication used in MDriven ====<br />
We use the newly added realtime functionality in several ways.<br />
# You can tag an attribute with "Realtime=true" , and systems that use WebApi communcations with an MDrivenServer will have the Attribute invalidated in a very short time after it was committed to the database. This functionality enables you to discover changes and react to them faster with less resource consumption than what you could before.<br />
# MDrivenTurnkey - javascript client polled the server frequently to see if there where any updates to render, Now the client instead waits for an event from the server "WeGotNews" and then polls. Currently the client will still poll without this event - buut at a much lower frequency (68s instead of 8s)<br />
# WPF Wecpof applications did not have the auto polling as Turnkey used - instead a refresh poll was done on ViewOpen. This has now changed and WPF-Wecpof also has the auto refresh. To avoid needing to do the refresh when nothing has changed - we have an AllIsWell-event sent from the MDrivenServer that also gives information on the sync-version-id - that the client can use to decide if a poll is needed or not.<br />
<br />
=== Updates 2021 Feb ===<br />
SignalR actually comes in 2 versions; one called SignalR and one SignalRCore. The 2 versions are not message compatible. The 2 versions can act as a client in both .net core and .net Framework(>4.6.1).<br />
<br />
As we have the MDrivenServer- core version - and the built in in WPF Prototyper in MDrivenDesigner(.net Framework) - we have now added the capability to connect to a MDrivenServer-Core version from the MDrivenDesigner.<br />
<br />
If you have Framework based clients you can also do so by adding the nuget package Microsoft.AspNetCore.SignalR.Client. <br />
<br />
A framework based client that make use of the RealtimeStateSubscriberService will first try and connect to MDrivenServer Framework version with SignalR - if it fails it will then try and connect with SignalRCore.<br />
<br />
The Turnkey Javascript client will also first try Framework communication and if failing to connect will switch to core communication.<br />
<br />
==== Verify SignalR can connect (.net Framework) ====<br />
If you are behind a reverse proxy and you have trouble to get SignalR to connect - then just try these calls in browser and make sure they are not blocked:<br />
<br />
[https://yoursiteurl/signalr/negotiate?clientProtocol=2.1&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928727 https://yoursiteurl/signalr/negotiate?clientProtocol=2.1]<br />
<br />
[https://yoursiteurl/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://yoursiteurl/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
[https://yoursiteurl/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://yoursiteurl/signalr/start?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
https://yoursiteurl/signalr/ping?_=1636029928729<br />
<br />
[https://yoursiteurl/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://yoursiteurl/signalr/reconnect?transport=serverSentEvents&]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SignalR_and_Realtime&diff=6525Documentation:SignalR and Realtime2021-11-04T16:25:22Z<p>Henrik: </p>
<hr />
<div>==== What is SignalR and what is it used for ====<br />
SignalR is a .net software componenent used for Realtime communication. By realtime we mean that communication done point to point at the time of need.<br />
<br />
==== How is realtime communication used in MDriven ====<br />
We use the newly added realtime functionality in several ways.<br />
# You can tag an attribute with "Realtime=true" , and systems that use WebApi communcations with an MDrivenServer will have the Attribute invalidated in a very short time after it was committed to the database. This functionality enables you to discover changes and react to them faster with less resource consumption than what you could before.<br />
# MDrivenTurnkey - javascript client polled the server frequently to see if there where any updates to render, Now the client instead waits for an event from the server "WeGotNews" and then polls. Currently the client will still poll without this event - buut at a much lower frequency (68s instead of 8s)<br />
# WPF Wecpof applications did not have the auto polling as Turnkey used - instead a refresh poll was done on ViewOpen. This has now changed and WPF-Wecpof also has the auto refresh. To avoid needing to do the refresh when nothing has changed - we have an AllIsWell-event sent from the MDrivenServer that also gives information on the sync-version-id - that the client can use to decide if a poll is needed or not.<br />
<br />
=== Updates 2021 Feb ===<br />
SignalR actually comes in 2 versions; one called SignalR and one SignalRCore. The 2 versions are not message compatible. The 2 versions can act as a client in both .net core and .net Framework(>4.6.1).<br />
<br />
As we have the MDrivenServer- core version - and the built in in WPF Prototyper in MDrivenDesigner(.net Framework) - we have now added the capability to connect to a MDrivenServer-Core version from the MDrivenDesigner.<br />
<br />
If you have Framework based clients you can also do so by adding the nuget package Microsoft.AspNetCore.SignalR.Client. <br />
<br />
A framework based client that make use of the RealtimeStateSubscriberService will first try and connect to MDrivenServer Framework version with SignalR - if it fails it will then try and connect with SignalRCore.<br />
<br />
The Turnkey Javascript client will also first try Framework communication and if failing to connect will switch to core communication.<br />
<br />
==== Verify SignalR can connect (.net Framework) ====<br />
If you are behind a reverse proxy and you have trouble to get SignalR to connect - then just try these calls in browser and make sure they are not blocked:<br />
<br />
[https://yoursiteurl/signalr/negotiate?clientProtocol=2.1&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928727 https://hkscratch.azurewebsites.net/signalr/negotiate?clientProtocol=2.1]<br />
<br />
[https://yoursiteurl/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
[https://yoursiteurl/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
https://yoursiteurl/signalr/ping?_=1636029928729<br />
<br />
[https://yoursiteurl/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SignalR_and_Realtime&diff=6524Documentation:SignalR and Realtime2021-11-04T16:24:18Z<p>Henrik: </p>
<hr />
<div>==== What is SignalR and what is it used for ====<br />
SignalR is a .net software componenent used for Realtime communication. By realtime we mean that communication done point to point at the time of need.<br />
<br />
==== How is realtime communication used in MDriven ====<br />
We use the newly added realtime functionality in several ways.<br />
# You can tag an attribute with "Realtime=true" , and systems that use WebApi communcations with an MDrivenServer will have the Attribute invalidated in a very short time after it was committed to the database. This functionality enables you to discover changes and react to them faster with less resource consumption than what you could before.<br />
# MDrivenTurnkey - javascript client polled the server frequently to see if there where any updates to render, Now the client instead waits for an event from the server "WeGotNews" and then polls. Currently the client will still poll without this event - buut at a much lower frequency (68s instead of 8s)<br />
# WPF Wecpof applications did not have the auto polling as Turnkey used - instead a refresh poll was done on ViewOpen. This has now changed and WPF-Wecpof also has the auto refresh. To avoid needing to do the refresh when nothing has changed - we have an AllIsWell-event sent from the MDrivenServer that also gives information on the sync-version-id - that the client can use to decide if a poll is needed or not.<br />
<br />
=== Updates 2021 Feb ===<br />
SignalR actually comes in 2 versions; one called SignalR and one SignalRCore. The 2 versions are not message compatible. The 2 versions can act as a client in both .net core and .net Framework(>4.6.1).<br />
<br />
As we have the MDrivenServer- core version - and the built in in WPF Prototyper in MDrivenDesigner(.net Framework) - we have now added the capability to connect to a MDrivenServer-Core version from the MDrivenDesigner.<br />
<br />
If you have Framework based clients you can also do so by adding the nuget package Microsoft.AspNetCore.SignalR.Client. <br />
<br />
A framework based client that make use of the RealtimeStateSubscriberService will first try and connect to MDrivenServer Framework version with SignalR - if it fails it will then try and connect with SignalRCore.<br />
<br />
The Turnkey Javascript client will also first try Framework communication and if failing to connect will switch to core communication.<br />
<br />
==== Verify SignalR can connect (.net Framework) ====<br />
If you are behind a reverse proxy and you have trouble to get SignalR to connect - then just try these calls in browser and make sure they are not blocked:<br />
<br />
[https://<yoursiteurl>/signalr/negotiate?clientProtocol=2.1&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928727 https://hkscratch.azurewebsites.net/signalr/negotiate?clientProtocol=2.1]<br />
<br />
[https://<yoursiteurl>/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
[https://yoursiteurl/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
https://<yoursiteurl>/signalr/ping?_=1636029928729<br />
<br />
[https://<yoursiteurl>/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SignalR_and_Realtime&diff=6523Documentation:SignalR and Realtime2021-11-04T16:23:09Z<p>Henrik: </p>
<hr />
<div>==== What is SignalR and what is it used for ====<br />
SignalR is a .net software componenent used for Realtime communication. By realtime we mean that communication done point to point at the time of need.<br />
<br />
==== How is realtime communication used in MDriven ====<br />
We use the newly added realtime functionality in several ways.<br />
# You can tag an attribute with "Realtime=true" , and systems that use WebApi communcations with an MDrivenServer will have the Attribute invalidated in a very short time after it was committed to the database. This functionality enables you to discover changes and react to them faster with less resource consumption than what you could before.<br />
# MDrivenTurnkey - javascript client polled the server frequently to see if there where any updates to render, Now the client instead waits for an event from the server "WeGotNews" and then polls. Currently the client will still poll without this event - buut at a much lower frequency (68s instead of 8s)<br />
# WPF Wecpof applications did not have the auto polling as Turnkey used - instead a refresh poll was done on ViewOpen. This has now changed and WPF-Wecpof also has the auto refresh. To avoid needing to do the refresh when nothing has changed - we have an AllIsWell-event sent from the MDrivenServer that also gives information on the sync-version-id - that the client can use to decide if a poll is needed or not.<br />
<br />
=== Updates 2021 Feb ===<br />
SignalR actually comes in 2 versions; one called SignalR and one SignalRCore. The 2 versions are not message compatible. The 2 versions can act as a client in both .net core and .net Framework(>4.6.1).<br />
<br />
As we have the MDrivenServer- core version - and the built in in WPF Prototyper in MDrivenDesigner(.net Framework) - we have now added the capability to connect to a MDrivenServer-Core version from the MDrivenDesigner.<br />
<br />
If you have Framework based clients you can also do so by adding the nuget package Microsoft.AspNetCore.SignalR.Client. <br />
<br />
A framework based client that make use of the RealtimeStateSubscriberService will first try and connect to MDrivenServer Framework version with SignalR - if it fails it will then try and connect with SignalRCore.<br />
<br />
The Turnkey Javascript client will also first try Framework communication and if failing to connect will switch to core communication.<br />
<br />
==== Verify SignalR can connect (.net Framework) ====<br />
If you are behind a reverse proxy and you have trouble to get SignalR to connect - then just try these calls in browser and make sure they are not blocked:<br />
<br />
[https://<yoursiteurl>/signalr/negotiate?clientProtocol=2.1&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928727 https://hkscratch.azurewebsites.net/signalr/negotiate?clientProtocol=2.1]<br />
<br />
[https://<yoursiteurl>/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
[https://<yoursiteurl>/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1]<br />
<br />
https://<yoursiteurl>/signalr/ping?_=1636029928729<br />
<br />
[https://<yoursiteurl>/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:IIS_troubleshoot&diff=6221Documentation:IIS troubleshoot2021-04-29T10:11:04Z<p>Henrik: </p>
<hr />
<div>If your Turnkey application does not start in IIS follow these guide lines to pinpoint problem area:<br />
<br />
In the Turnkey web.config file, remove the section that makes errors route into the application:<br />
<!-- Map common 4xx errors to a Viewmodel called RedirectView sending along the variable ErrorCode--><br />
<httpErrors '''errorMode="Detailed"''' ><br />
</httpErrors><br />
If you do not replace this - some errors will be rerouted into the same situation that has the problem.<br />
<br />
Make sure you have <br />
<system.web><br />
<compilation debug="true" /><br />
<br />
*Advanced settings for AppPool* (to consider)<br />
<br />
Specific time same every day<br />
<br />
allow overlap AppPool recycle<br />
<br />
Idle time out action Suspend appPool (not terminate)<br />
<br />
(To be completed)</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6151Training:Installing MDriven Server on Windows2021-03-16T15:16:03Z<p>Henrik: </p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
<br />
The following features are required to install. ISAPI are dependant on ASP.Net 4.7 and may be skipped. <br />
<br />
[[File:FeaturesMDrivenServerInstall.JPG|none|thumb|356x356px|Features to activate]]<br />
<br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp) OR (if you want the app on site root level, choose the site in IIS and deploy the TurnkeyServer. Add __MDrivenServer in the samme manner as below) <br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
== Problem solving ==<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6150Training:Installing MDriven Server on Windows2021-03-16T15:14:00Z<p>Henrik: </p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
FeaturesMDrivenServerInstall.JPG<br />
<br />
[[File:FeaturesMDrivenServerInstall.JPG|none|thumb|356x356px|Features to activate]]<br />
<br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp) OR (if you want the app on site root level, choose the site in IIS and deploy the TurnkeyServer. Add __MDrivenServer in the samme manner as below) <br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
== Problem solving ==<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=File:FeaturesMDrivenServerInstall.JPG&diff=6149File:FeaturesMDrivenServerInstall.JPG2021-03-16T15:12:18Z<p>Henrik: </p>
<hr />
<div></div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6032Training:Installing MDriven Server on Windows2021-02-04T13:40:19Z<p>Henrik: /* Installing of MDriven Server */</p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp) OR (if you want the app on site root level, choose the site in IIS and deploy the TurnkeyServer. Add __MDrivenServer in the samme manner as below) <br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
== Problem solving ==<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6031Training:Installing MDriven Server on Windows2021-02-04T13:39:47Z<p>Henrik: /* Installing of MDriven Server */</p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp) OR (if you want the app on site root level, choose the site in IIS and deploy the TurnKeyServer. Add __MDrivenServer in the samme manner as below) <br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
== Problem solving ==<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Turn_on_websocket_in_IIS&diff=6026Documentation:Turn on websocket in IIS2021-02-02T10:12:09Z<p>Henrik: </p>
<hr />
<div><br />
The webclient uses websockets towards the Turnkey server, and the Turnkey Server is called using websockets by the MDriven Server in order to refresh its data.<br />
<br />
==> Websockets are needed on both Turnkey and MDriven Server<br />
<br />
[[File:2021-01-19 15h25 52.png|none|thumb|758x758px]]<br />
[[File:2021-01-19 15h26 38.png|none|thumb|756x756px]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:BankId&diff=6011Documentation:BankId2021-01-26T07:46:31Z<p>Henrik: Created page with "''"BankID is the leading electronic identification in Sweden. BankID has been developed by a number of large banks for use by members of the public, authorities and companies...."</p>
<hr />
<div>''"BankID is the leading electronic identification in Sweden. BankID has been developed by a number of large banks for use by members of the public, authorities and companies. The first BankID was issued in 2003. The BankID network includes Danske Bank, ICA Banken, Länsförsäkringar Bank, Nordea, SEB, Skandiabanken, Sparbanken Syd, Svenska Handelsbanken, Swedbank and Ålandsbanken. 8 million people use BankID on a regular basis for a wide variety of private and public services." (ref Bankid.com)''<br />
<br />
Implementing BankId for authorization is quite straitforward using MDriven with the EXCEPTION that BankId currently requires a trusted certificate store. <br />
<br />
'''At present this means that you need a dedicated server or a hybrid solution such as "Azure App Service Environment" to achive this.'''<br />
<br />
<br />
Please note the the public key (to be stored in the trusted store) needs to created from the documentation PDF, using notepad or similar.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6003Training:Installing MDriven Server on Windows2021-01-21T13:05:13Z<p>Henrik: </p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp)<br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
== Problem solving ==<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:Installing_MDriven_Server_on_Windows&diff=6002Training:Installing MDriven Server on Windows2021-01-21T13:04:02Z<p>Henrik: </p>
<hr />
<div>This guide may help you to install MDriven Server on '''Windows(8, 10)''', '''Windows 2012R2''' and '''Windows 2016'''. If you use Windows 7 Enterprise and you have a problem with installation of MDriven Server, please see this article - '''[[Installation of MDriven Server on Windows 7 Enterprise.]]'''<br />
<br />
== Installing IIS Services and its components ==<br />
First of all, you need to install IIS on your computer, on Windows(8, 10) head to the ''Control Panel'' -> ''Programs and Features'' -> ''Turn Windows features on or off'' and add '''Internet Information Services'''.<br />
<br />
On Windows 2012R2 or Windows 2016 after installation add roles: '''Web server IIS'''.<br />
[[File:Add the IIS on Windows(8, 10).jpg|none|thumb|356x356px|Add IIS on Windows(8, 10)]]<br />
Also, you need to add '''ASP .NET''' 4.5(or higher) and its component. <br />
<br />
=== If you are using WCF the following IIS features should be switched on (WebApi does not use them) ===<br />
'''Important!''' Under .NET Framework 4.7(or higher) "Features", head to WCF Services and select '''HTTP Activation''' and '''TCP Port Sharing'''.<br />
<br />
'''Important!''' For Windows 10, Under World Wide Web Services, Common HTTP Features, select '''Static Content''' if it's not selected.<br />
[[File:Add HTTP Activation and TCP Port Sharing.jpg|none|thumb|359x359px|Add HTTP Activation and TCP Port Sharing]]<br />
You should also consider adding: <br />
* Logging Tools<br />
* Request Monitor<br />
* Tracing<br />
* Dynamic Content Compression<br />
* Application Initialization<br />
* Management Service<br />
* ''IIS Management Scripts and Tools - also see this described in the next section''<br />
* Basic Authentication, Windows authentication or another authentication service<br />
'''Note!''' If you don’t install '''HTTP Activation''', you will get “Error 405 – method not allowed” instead of the MDriven login screen.<br />
<br />
Now, you can start '''IIS Manager''' on your computer.<br />
<br />
''If you had some troubles with installation on Windows 2012R2 see also — https://docs.microsoft.com/en-us/iis/install/installing-iis-85/installing-iis-85-on-windows-server-2012-r2<nowiki/>.''<br />
<br />
== Setting up IIS Manager ==<br />
After installation of IIS, you should install Microsoft Web Platform Installer 5.0 - https://www.microsoft.com/web/downloads/platform.aspx<br />
<br />
After the installation, open Web Platform Installer head to Products and install following components to IIS:<br />
# Web Deploy (or download Web Deploy from Microsoft website - https://www.iis.net/downloads/microsoft/web-deploy)<br />
##Make sure you get IIS Deployment Handler installed (Custom installation, or Add programs + Change installation)[[File:2020-09-03 11h11 44.png|none|thumb|311x311px]]If you do see the "IIS Deployment Handler" option it is because the following IIS feature is not turned on:<br />
###[[File:2020-09-09 09h57 25.png|none|thumb]]Make sure you turn that on and run a Repair on WebDeploy -> now you have the "IIS Deployment Handler" <br />
The WebDeploy gives IIS the Import Application option that greatly simplifies install and updates:<br />
[[File:2020-09-09 10h08 18.png|none|thumb]]<br />
<br />
== Install MDriven Server ==<br />
<br />
=== Add an Application Pool ===<br />
Start IIS Manager and add an Application Pool.<br />
[[File:Add an Application Pool.jpg|none|thumb|616x616px|Add an Application Tool in IIS Manager]]<br />
Name your Pool and set it to '''.NET CLR 4.0''' and '''Integrated pipeline''' mode.<br />
[[File:Creating of App Pool.jpg|none|thumb|Create Application Tool]]<br />
<br />
=== Configure the AppPool ===<br />
Select your Application Pool and head to ''Advanced Settings'' and set:<br />
* ''Start mode'': '''AlwaysRunning'''<br />
* ''Identity'': '''<choose what suits your needs>'''<br />
* ''Limit interval'': '''1'''<br />
[[File:Setting up the Application Pool.jpg|none|thumb|383x383px|Setting up the Application Tool]]<br />
<br />
==== Check file permissions ====<br />
Check this page for information on the [[AppPool user]] settings<br />
<br />
The application will act as the AppPool user when accessing the disc. The application will also use "%temp%" for extracting AssetsTK and CodeDress assembliess from the modlr file. The AppPool user will also need access to the whole application in order to distribute codedress assemblies. Also the Logg subdirectory must allow write. <br />
<br />
=== Add a certificate for SSL ===<br />
In ISS Manager select Server Certificates and create '''Self-Signed Certificate'''.<br />
<br />
'''Note!''' Create the self signed certificate with you servers machine name.<br />
<br />
Notice the name in the certificates "Issued to" field. You'll be using this name when you access your server. <br />
<br />
If you don't use this URL, you'll get a certificate error, and the server won't be able to communicate internally, so you can't ignore this error!<br />
<br />
[[Fault-finding certificate problems in IIS]]<br />
[[File:Server Certificates.jpg|none|thumb|604x604px|Server Certificates in IIS]]<br />
On the Default web site or on web site which you created, add '''https binding''' for '''port 443''' and select the certificate needed.<br />
[[File:Add bindings to the site.jpg|none|thumb|605x605px|Add bindings to the site]]<br />
<br />
=== Installing of MDriven Server ===<br />
* Add an application and give a descriptive name. Select the Application Pool which you created earlier.<br />
# Create an application with your name ("MyTurnkeyApp)<br />
# Create another application under “MyTrunkeyApp” called “__MDrivenServer” (double underscore) so that it ends up like this: “MyTurnkeyApp/__MDrivenServer”<br />
* Use the deploy function to import the application MDriven Server & MDriven Turnkey which you download from the [https://mdriven.net/downloads mdriven.net] site (downloaded zip file will work directly with deploy). ''The installer will not overwrite your existing database if this is an upgrade.'' The normal choice when upgrading the framework is to overwrite and not remove the existing files.<br />
[[File:Deploy the MDriven Server.jpg|none|thumb|634x634px|Deploy the MDriven Server]]<br />
'''''Note:''' During installation of MDriven Server or MDriven Turnkey app, if you created the structure before, keep "application path" field empty to save the needed folders' structure.''<br />
<br />
As a result you will get the following application structure:<br />
[[File:Application_Structure.jpg|none|thumb|Application structure]]<br />
<br />
== Setting up MDriven Server ==<br />
Now, you can open your MDrivenServer in a browser via link<br />
<br />
<code><nowiki>https://localhost/</nowiki><Your_application_name>/__MDrivenServer/</code><br />
<br />
'''Important!''' You have to change "localhost" in a link to the URL in your certificate (which is usually your full machine name including domain). <br />
<br />
On the first screen you should register a new user for MDriven Server. For example "admin" (not "a", used by Turnkey)<br />
<br />
[[File:MDriven Server start page.jpg|frameless|347x347px]]<br />
<br />
After this you may log in and head to '''Admin area''' -> '''Infos, errors and MDrivenServer evolve''' and push "Evolve Admin database.<br />
<br />
'''Important!''' MDriven Turnkey will use a user account named “a”, so you need to go back and head to ''AutoForm'' select ''"databaseIdentity"'' to admin.<br />
[[File:Change user name.jpg|none|thumb|379x379px|Setting up the "a" user]]<br />
Choose ''ASP_User'' -> ''Show'' and there you can see all user of MDriven Server. The user "a" will be on the top, if you click on the "Details" you will be able to change user name to another one.<br />
<br />
After this, you can ''log out'' and ''register'' user "a" with your own password.<br />
<br />
#Problem solving<br />
<br />
If you get a 403 error when trying to start the MDriven server, please make sure that ASP.Net 4.7 (or higher) is installed<br />
<br />
== Video Tutorial ==<br />
<br />
(Please note that the video was created when the MDriven Server was called "Boring Predictable Server" as a working name)<br />
<br />
<html><br />
<br />
<p class="video-warn"><br />
To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini<br />
player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now<br />
you can pick any topic to be instructed without watching the whole video.<br />
</p><br />
<br />
<div class="video"><br />
<div class="video__wrapper"><br />
<iframe src="https://www.youtube.com/embed/q0ppL5sMPGg"?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe><br />
</div><br />
<div class="video__navigation"><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="0" tabindex="0"> Setting up a Local MDrivenTurnkey application </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="17" tabindex="0"> Creating site </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="115" tabindex="0"> Installing the MDriven server software </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="153" tabindex="0"> Pouring in information for IIS </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="242" tabindex="0"> Checking MDriven server </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="305" tabindex="0"> Adding a certificate </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="428" tabindex="0"> Register a user </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="575" tabindex="0"> Set up Turnkey Settings </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="763" tabindex="0"> Uploading the Model </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="822" tabindex="0"> Creating Index ViewModel </span><br />
<span class="navigation-item" data-video="q0ppL5sMPGg" data-start="900" tabindex="0"> ASPNETIdentity Snippets </span><br />
</div><br />
</div><br />
<br />
</html><br />
<br />
[[Category:Advanced]]<br />
[[Category:MDriven Server]]<br />
[[Category:Installation]]<br />
[[Category:Tutorial]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5984Documentation:Swish2021-01-13T16:52:41Z<p>Henrik: /* SWISH */</p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the Simulator guide (zipfile) containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]<br />
<br />
Using an webapp on Azure you need to install the .pfx certificates (in the zip) for merchants as '''Private Key Certificates'''. You also need to install the corresponding '''Public Key Certificates'''. I did this by importing the .pfx to the windows key store on my developer machine and the export the public key (for import to Azure).<br />
<br />
Gotchas: When importing the cert to the local machine. Use double-click on the certificate to start the import. I had some issues to get it working locally before I did that. <br />
<br />
The certificate needs to be installed in the machine initiating the call, server or others. Running it using the debugger - your machine (It will log if certificate-thumbprint found in the logging part of the debugger)<br />
<br />
Also I added the ''application setting'' : WEBSITE_LOAD_CERTIFICATES with value "*" in order to ensure that the webapp has access to the certficates.<br />
<br />
The SWISH-server callback is a POST using a JSON raw body as described here [[https://wiki.mdriven.net/index.php/Rest_Services_In_MDriven]] '''Receive string content'''</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5983Documentation:Swish2021-01-13T16:51:47Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the Simulator guide (zipfile) containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]<br />
<br />
Using an webapp on Azure you need to install the .pfx certificates (in the zip) for merchants as '''Private Key Certificates'''. You also need to install the corresponding '''Public Key Certificates'''. I did this by importing the .pfx to the windows key store on my developer machine and the export the public key (for import to Azure).<br />
<br />
Gotchas: When importing the cert to the local machine. Use double-click on the certificate to start the import. I had some issues to get it working locally before I did that. <br />
<br />
The certificate needs to be installed in the machine initiating the call, server or others. Running it using the debugger - your machine (It will log if certificate-thumbprint found in the logging part of the debugger)<br />
<br />
Also I added the ''application setting'' : WEBSITE_LOAD_CERTIFICATES with value "*"<br />
<br />
The SWISH-server callback is a POST using a JSON raw body as described here [[https://wiki.mdriven.net/index.php/Rest_Services_In_MDriven]] '''Receive string content'''</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5982Documentation:Swish2021-01-13T16:37:04Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the Simulator guide (zipfile) containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]<br />
<br />
Using an webapp on Azure you need to install the .pfx certificates (in the zip) for merchants as '''Private Key Certificates'''. You also need to install the corresponding '''Public Key Certificates'''. I did this by importing the .pfx to the windows key store on my developer machine and the export the public key (for import to Azure).<br />
<br />
Also I added the ''application setting'' : WEBSITE_LOAD_CERTIFICATES with value "*"<br />
<br />
The SWISH-server callback is a POST using a JSON raw body. [[Link title]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5981Documentation:Swish2021-01-13T16:35:13Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the Simulator guide (zipfile) containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]<br />
<br />
Using an webapp on Azure you need to install the .pfx certificates (in the zip) for merchants as '''Private Key Certificates'''. You also need to install the corresponding '''Public Key Certificates'''. I did this by importing the .pfx to the windows key store on my developer machine and the export the public key (for import to Azure).<br />
<br />
Also I added the ''application setting'' : WEBSITE_LOAD_CERTIFICATES with value "*"<br />
[[File:Example.jpg]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5980Documentation:Swish2021-01-13T16:31:32Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the Simulator guide (zipfile) containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]<br />
<br />
Using an webapp on Azure you need to install the .pfx certificates (in the zip) for merchants as '''Private Key Certificates'''. You also need to install the corresponding ''Public Key Certificates''. I did this by importing the .pfx to the windows key store on my developer machine and the export the public key (for import to Azure).</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5930Documentation:Swish2021-01-04T17:54:04Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the zipfile containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT OBJECT using a certificate, the user pays using a mobile ,the Swish server will then issue a callback towards your server withe the result using a POST containing the result<br />
<br />
[[File:Swish1.png]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5929Documentation:Swish2021-01-04T16:36:21Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the zipfile containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT object using a certificate, the user pays using a mobile ,the swish server will then issue a callback towards your server withe the result.<br />
<br />
[[File:Swish1.png]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=File:Swish1.png&diff=5928File:Swish1.png2021-01-04T16:34:12Z<p>Henrik: Henrik uploaded a new version of File:Swish1.png</p>
<hr />
<div></div>Henrikhttps://wiki.mdriven.net/index.php?title=File:Swish1.png&diff=5927File:Swish1.png2021-01-04T16:33:06Z<p>Henrik: </p>
<hr />
<div></div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5926Documentation:Swish2021-01-04T16:06:42Z<p>Henrik: </p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to Swish for merchants at [[https://www.swish.nu/developer#swish-for-merchants]] and download the zipfile containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT object using a certificate, the user pays using a mobile ,the swish server will then issue a callback towards your server withe the result.<br />
<br />
[[File:Swish1.jpg]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Swish&diff=5925Documentation:Swish2021-01-04T15:55:51Z<p>Henrik: Created page with "Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they o..."</p>
<hr />
<div>Swish is a mobile payment solution backed by a number of Swedish banks. If you want to support this in your application, you need a special agreement with your bank but they offer a Swish simulator that allows for development purposes. <br />
<br />
Go to [[https://www.swish.nu/developer#swish-for-merchants]] and download the zipfile containing both an pdf with instructions and a number of certificates. <br />
<br />
In principle is the payment (for merchants) started by a PUT operation using a Json PAYMENT object using a certificate, the user pays using a mobile ,the swish server will then issue a callback towards your server withe the result.<br />
<br />
[[File:Swish1.jpg]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:OCLOperators_ViewModelAsXml&diff=5696Documentation:OCLOperators ViewModelAsXml2020-10-29T16:49:25Z<p>Henrik: </p>
<hr />
<div>=== Usage ===<br />
Used to create XML documents based on a viewmodel.<br />
<br />
Example;<br />
selfVM.ViewModelAsXml('ReportExportToXML', vCurrent_ReportExportView)<br />
This code will output a valid XML text for saving to a file/downloaded by a client;<br />
vCurrent_ReportExportView.XML := selfVM.ViewModelAsXml('ReportExportToXML', vCurrent_ReportExportView).<br />
replace('<root>', '<?xml version="1.0" encoding="ISO-8859-1"?>').<br />
replace('</root>', <nowiki>''</nowiki>);<br />
In the example the root elements are replaced/removed and an XML header is added to make it a XML file (not a DOM representation).<br />
<br />
Note the encoding in the XML header says ISO-8859-1. But the '''string''' type in .Net is always Unicode in memory. To save this correctly you need to convert it upon saving.<br />
<br />
You can convert from Unicode to ISO-8859-1 like this (generated XML is stored in self.XML in this example);<br />
self.XML.[[OCLOperators StringToEncodedBase64|StringToEncodedBase64]](28591).[[OCLOperators Base64ToBlob|Base64ToBlob]]<br />
The value 28591 is ''ISO 8859-1 Latin 1; Western European (ISO)'' taken from this table: https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers<br />
<br />
Converting it to a blob is necessary for downloading and will create a download link, read more here: [[BlobDownloadLink]]<br />
[[File:ViewModelToXMLexample.png|none|thumb|608x608px]]<br />
<br />
vill result in this output.<br />
<code><br />
<?xml version="1.0" encoding="ISO-8859-1"?><br />
<SalaryData Created="2020-09-11" CompanyName="Model agency" OrgNo="825002-1295" ProgramName="TrainerTime"><br />
<TimeCodes><br />
<TimeCode Code="11061" TimeCodeName="Timlön inkl semesterersättning" /><br />
<TimeCode Code="11062" TimeCodeName="Tillägg förstatränare" /><br />
<TimeCode Code="11063" TimeCodeName="Tillägg hjälptränare" /><br />
</TimeCodes><br />
<SalaryDataEmployee FromDate="2020-08-01" ToDate="2020-08-31"><br />
<Employee EmploymentNo="001" FirstName="First" Name="Last" FromDate="2020-08-01" ToDate="2020-08-31"><br />
<NormalWorkingTimes></NormalWorkingTimes><br />
<Times><br />
<Time DateOfReport="2020-08-31" SumOfHours="8.59" TimeCode="11061" /><br />
<Time DateOfReport="2020-08-31" SumOfHours="2.34" TimeCode="11063" /><br />
<Time DateOfReport="2020-08-31" SumOfHours="1.00" TimeCode="11062" /><br />
</Times><br />
<TimeAdjustments></TimeAdjustments><br />
<TimeBalances></TimeBalances><br />
<RegOutlays></RegOutlays><br />
</Employee><br />
<Employee EmploymentNo="003" FirstName="Third" Name="Four" FromDate="2020-08-01" ToDate="2020-08-31"><br />
<NormalWorkingTimes></NormalWorkingTimes><br />
<Times><br />
<Time DateOfReport="2020-08-31" SumOfHours="7.92" TimeCode="11061" /><br />
</Times><br />
<TimeAdjustments></TimeAdjustments><br />
<TimeBalances></TimeBalances><br />
<RegOutlays></RegOutlays><br />
</Employee><br />
<Employee EmploymentNo="004" FirstName="Five" Name="Six" FromDate="2020-08-01" ToDate="2020-08-31"><br />
<NormalWorkingTimes></NormalWorkingTimes><br />
<Times><br />
<Time DateOfReport="2020-08-31" SumOfHours="18.50" TimeCode="11061" /><br />
<Time DateOfReport="2020-08-31" SumOfHours="18.50" TimeCode="11062" /><br />
</Times><br />
<TimeAdjustments></TimeAdjustments><br />
<TimeBalances></TimeBalances><br />
<RegOutlays></RegOutlays><br />
</Employee><br />
<Employee EmploymentNo="006" FirstName="Seven" Name="Eight" FromDate="2020-08-01" ToDate="2020-08-31"><br />
<NormalWorkingTimes></NormalWorkingTimes><br />
<Times><br />
<Time DateOfReport="2020-08-31" SumOfHours="28.68" TimeCode="11061" /><br />
</Times><br />
<TimeAdjustments></TimeAdjustments><br />
<TimeBalances></TimeBalances><br />
<RegOutlays></RegOutlays><br />
</Employee><br />
</SalaryDataEmployee><br />
</SalaryData></code><br />
<br />
<br />
=== Tagged value options ===<br />
<br />
==== NodeName ====<br />
If you set the tagged value NodeName of the viewmodel attribute, that name will be used instead of the viewmodel attribute name. This enables you to have for example - (dash) in the node name. Note that you can't use this to add a namespace to the name. (:xx)<br />
<br />
==== XmlChildnode ====<br />
Default for single associations in the viewmodel is to add more elements to the parent with the style <classname>.<attribute name>. If you use XmlChildNode = true, single associations will be rendered as an XML child element instead.<br />
<br />
Default for many associations in the viewmodel is to add a child element and then one child element under that for each object in the association. If you use XmlChildNode = false, the first child element will be omitted.<br />
<br />
Single-links don't that point to an object will not render anything with XmlChildNode active.<br />
<br />
==== XmlAttribute ====<br />
Default for attributes in the viewmodel is to be rendered as a XML element. If you use XmlAttribute = false, columns will be rendered as an XML attribute instead.<br />
<br />
==== XmlParentValue ====<br />
Makes the attribute's value appear as the parent element's value instead of an element. Note! If used on more that one attribute on the same viewmodel class, the result is undefined.<br />
<br />
=== See also ===<br />
[[OCLOperators StringToBase64]] for UTF8 encoding.<br />
<br />
[[OCLOperators XsltTransformXml]] for transforming the created XML to another format.<br />
<br />
[[OCLOperators ViewModelAsJSon]] to get the same information as JSON</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:The_ExternalId_explained&diff=5693Documentation:The ExternalId explained2020-10-24T15:22:44Z<p>Henrik: </p>
<hr />
<div>TheExternalId of objects in MDriven take on the form of classindex!objectid - for example 9!10 refers to an object stored with primary key 10 in a model where the 9:th class gives the table name.<br />
<br />
The class id must be present in order for the framework to know in what class your object resides.<br />
<br />
The class id will however change when you update the model.<br />
<br />
Class Id 0 always refers to the topological highest class in your model - the root of everything - this is often abstract. The framework can try and look up objects this way but as you can imagine - it would need to search all tables in order to find the relevant class.<br />
<br />
To make the externalid a bit more resilient to change we now allow for you to send in class name: Thing!10<br />
<br />
This is good when exposing the externalids in links etc and thus possibly make them more exposed than what they where designed for.<br />
<br />
For example in MVC we have a controller GetImage that expects a object identity and a attribute with a blob, like this: [http://localhost:5052/Turnkey/GetImage?img=Thing!GP!ad833fd8383c4389a88f3349166e7a74-SomeImage http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage]<br />
<br />
You can now write : [http://localhost:5052/Turnkey/GetImage?img=Thing!GP!ad833fd8383c4389a88f3349166e7a74-SomeImage http://localhost:5052/Turnkey/GetImage?img=Thing!10-SomeImage] instead to make sure that the link survives in changed models.<br />
<br />
It is also best practice to have a Guid attribute on all of your classes as described in [[Information hygiene|Information Hygiene]].<br />
<br />
If you have so an even better way would be to use the guid in exposed links possibly saved by others.<br />
<br />
We have now extended the interpretation of sent in ExternalId's to allow for use of this GuidProperty. This is how: <classid>!GP!<guid> - ie GP is short for Guid Property.<br />
<br />
This enables us to express the guid in shortformat (Guid.ToString('N') removes the -) like this:<br />
<br />
http://localhost:5052/Turnkey/GetImage?img=Thing!GP!ad833fd8383c4389a88f3349166e7a74-SomeImage where "SomeImage" is the attribute name of the image.<br />
<br />
What is good about this is that the exposed information is now not tied to anything that change easily for a specific system instance. This way we can trust that links are consistent over time.<br />
<br />
See Also [[The_VMClassId_Explained]]<br />
<br />
See also [[MVC GetImage]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SysSingleton_GetSystemUrl&diff=5692Documentation:SysSingleton GetSystemUrl2020-10-23T10:59:17Z<p>Henrik: </p>
<hr />
<div>By adding this method to your SysSingleton and marking it with Eco.ExternalLateBound=anyvalue you can get access to the running turnkey system's url address:<br />
SysSingleton.GetSystemUrl():string<br />
[[File:2018-08-06 21h32 08.png|none|thumb|1000x1000px|x]]<br />
Making the method "IsQuery" makes it available in ocl (not only action language) - and you can write things like this:<br />
SysSingleton.oclSingleton.GetSystemUrl()+ '/SiteAssets/ProjectReportTemplate.odt'<br />
...this will fully qualify the address to a report template found in SiteAssets.<br />
<br />
Or maybe you need an QRImage with a fully qualified url back to your system:<br />
ZXing.QRImage(300,300,SysSingleton.oclSingleton.GetSystemUrl()+<br />
'/Turnkey/AngularApp#/ToolInfo/'+self.Guid.asstring)<br />
<br />
Please note that this is the URL of the TurnKeyserver. Thus is an action originating from TurnKey needed to set the URL, this action may be if needed to persist the adress for server-side jobs or SysAsync tickets running on MDrivenServer.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SysSingleton_GetSystemUrl&diff=5691Documentation:SysSingleton GetSystemUrl2020-10-23T10:58:33Z<p>Henrik: </p>
<hr />
<div>By adding this method to your SysSingleton and marking it with Eco.ExternalLateBound=anyvalue you can get access to the running turnkey system's url address:<br />
SysSingleton.GetSystemUrl():string<br />
[[File:2018-08-06 21h32 08.png|none|thumb|1000x1000px|x]]<br />
Making the method "IsQuery" makes it available in ocl (not only action language) - and you can write things like this:<br />
SysSingleton.oclSingleton.GetSystemUrl()+ '/SiteAssets/ProjectReportTemplate.odt'<br />
...this will fully qualify the address to a report template found in SiteAssets.<br />
<br />
Or maybe you need an QRImage with a fully qualified url back to your system:<br />
ZXing.QRImage(300,300,SysSingleton.oclSingleton.GetSystemUrl()+<br />
'/Turnkey/AngularApp#/ToolInfo/'+self.Guid.asstring)<br />
<br />
Please note that this is the URL of the TurnKeyserver. Thus is an action originating from TurnKey needed to set the URL, this action may be if needed to persist for server-side jobs or SysAsync tickets running on MDrivenServer.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:SysSingleton_GetSystemUrl&diff=5690Documentation:SysSingleton GetSystemUrl2020-10-23T10:57:10Z<p>Henrik: </p>
<hr />
<div>By adding this method to your SysSingleton and marking it with Eco.ExternalLateBound=anyvalue you can get access to the running turnkey system's url address:<br />
SysSingleton.GetSystemUrl():string<br />
[[File:2018-08-06 21h32 08.png|none|thumb|1000x1000px|x]]<br />
Making the method "IsQuery" makes it available in ocl (not only action language) - and you can write things like this:<br />
SysSingleton.oclSingleton.GetSystemUrl()+ '/SiteAssets/ProjectReportTemplate.odt'<br />
...this will fully qualify the address to a report template found in SiteAssets.<br />
<br />
Or maybe you need an QRImage with a fully qualified url back to your system:<br />
ZXing.QRImage(300,300,SysSingleton.oclSingleton.GetSystemUrl()+<br />
'/Turnkey/AngularApp#/ToolInfo/'+self.Guid.asstring)<br />
<br />
Please note that this is the URL of the TurnKeyserver. Thus is an action originating from TurnKey needed to set the URL, this if needed for server-side jobs or similar.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Onboarding&diff=5689Documentation:Onboarding2020-10-23T10:52:53Z<p>Henrik: Created page with "There are cases where you may want to send emails for user invites. The easiest way to do this is to send them a link to a page using the externalId reference. If this page is..."</p>
<hr />
<div>There are cases where you may want to send emails for user invites. The easiest way to do this is to send them a link to a page using the externalId reference. If this page is password protected will the user be redirected to the the login/registration page. After completion of either is the CurrentUser set and it is possible to link the object referenced by the exteralId to the logged in user.</div>Henrikhttps://wiki.mdriven.net/index.php?title=Training:External_login_services_in_MDriven_Turnkey&diff=5664Training:External login services in MDriven Turnkey2020-09-27T19:16:45Z<p>Henrik: Redirect URI need needs to be set</p>
<hr />
<div>This article helps you to set up the external login services (e.g. Google, Facebook, Microsoft) in MDriven Turnkey application. After these easy steps, your application will offer your users to sign in with their existing social accounts.<br />
<br />
Go to [https://portal.mdriven.net/ portal.mdriven.net] and sign in under your existent account. Head to your application (Views -> Show my Turnkey sites) in which you want to add the external login services.<br />
[[File:Block with settings for the external login services.jpg|none|thumb|428x428px|Block with settings for the external login services]]<br />
<br />
== Google Authentication ==<br />
To set up an authentication through Google Account in your Turnkey app, you need to go to https://console.developers.google.com. Sign in under your Google account (or sign up if you don`t have it). <br />
<br />
Head to '''Credentials''' and press "'''Create Credentia'''l" button and choose '''OAuth Client ID'''.<br />
<br />
Next, choose "Web application" and enter the name, home page URL and Redirect URL of your application.<br />
<br />
==== '''Important!''' ====<br />
At the end of redirect URL you need to add "'''signin-google'''", for example if your home page url is — ''<nowiki>https://mdriventestone.azurewebsites.net/</nowiki>'', your redirect url will be — ''https://mdriventestone.azurewebsites.net/signin-google''<br />
[[File:Google authentication settings.jpg|alt=Setting up Google Authentication|none|thumb|415x415px|Setting up Google Authentication]]<br />
<br />
==== Turn on the Google+ API ====<br />
Turn on the Google+ API. <br />
[[File:Google+ API .png|none|thumb]]<br />
<br />
==== Copy secrets to the portal ====<br />
Press Create and copy your '''Client ID''' and '''Client Secret''' from modal window to portal.mdriven.net.<br />
<br />
Save the changes and press "'''Send Settings and Restart'''" to add Google Authentication to your Turnkey App.<br />
<br />
== Facebook Authentication ==<br />
To set up an authentication through Facebook Account in your Turnkey App, you need to go to [https://developers.facebook.com/ https://developers.facebook.com] . Sign in under your Facebook account or register a new one.<br />
<br />
Head to "My apps" and choose "'''Add a new App'''". Name your app and on the next screen press "'''Set up'''" on '''Facebook login''' card.<br />
<br />
Next, select '''Web platform''' and enter '''Site URL''' (URL of your application) press save and continue and skip other steps. <br />
<br />
Head to Settings -> Basic and enter App domain (URL of your application), save the changes<br />
<br />
Also at Client OAuth Settings, add <SITE URL>/signin-facebook as a valid OAuth Redirect URI. <br />
<br />
Now copy App ID and App Secret to portal.mdriven.net. <br />
[[File:Facebook authentication settings.jpg|alt=Facebook authentication settings|none|thumb|598x598px|Facebook authentication settings]]<br />
Paste your App ID and App Secret to '''Facebook Client ID''' and '''Facebook Client Secret''', save the changes and press "'''Send settings and Restart'''" to add Facebook Authentication to your Turnkey App. <br />
<br />
== Microsoft Authentication ==<br />
To set up an authentication through Microsoft Account in your Turnkey app, you need to go to https://apps.dev.microsoft.com (Application Registration Portal). Sign in under your Microsoft Account and '''add a new application'''.<br />
<br />
Name your application and check (note: This name will be visible for users when they will use Microsoft Authentication) and press '''"Create"'''.<br />
<br />
On the next screen you will see registration information with '''App ID'''.<br />
[[File:Registration information of app.jpg|none|thumb|427x427px|Registration information of app]]<br />
Now you need to press "Generate New Password" button to create an Microsoft Client Secret.<br />
<br />
Your '''Client Secret''' will popup in a modal window and you need to copy (to portal.mdriven.net or to somewhere else, because it will be displayed only one time).<br />
[[File:Microsoft Client Secret.jpg|none|thumb|426x426px|Microsoft Client Secret]]<br />
Next, press "Add Platform" and choose "Web". After this, you will see the section where you need to enter '''Redirect URLs'''.<br />
<br />
'''!Important.''' You have to enter a full link to your app (e.g. https://mdriventestone.azurewebsites.net/) and add "'''signin-microsoft'''" at the end of a link.<br />
[[File:Platforms settings.jpg|none|thumb|677x677px|Enter home page url of your app]]<br />
Also, below this page you need to enter '''Home page URL''' of your application.<br />
<br />
Save the changes and copy your App ID and Client Secret to portal.mdriven.net (App ID to '''Microsoft Client Id''' and Client Secret to '''Microsoft Client Secret''').<br />
<br />
Save change and press "'''Send settings and restart'''" to add Microsoft Authentication to your Turnkey App.<br />
<br />
Extra info: You view an MS accounts given App rights at https://microsoft.com/consent<br />
<br />
==== Windows authentication ====<br />
In intranet environments you may want to use existing Kerberos windows auth for users of a turnkey site.<br />
<br />
Start by configuring the IIS to use authentication (this means the IIS is takes care of this prior to your application needs to ) - you can follow the [[MDrivenServer with Windows authentication|instruction for MDrivenServer]] for this.<br />
<br />
You must also do a manual change to the web.config of turnkey:<br />
<br />
<authentication mode="Windows" /><br />
[[File:2019-09-19 14h02 42.png|none|thumb|820x820px]]<br />
[[Category:MDriven Turnkey]]<br />
[[Category:Authentication]]<br />
[[Category:Intermediate]]</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Eventlog&diff=5581Documentation:Eventlog2020-09-08T08:22:49Z<p>Henrik: </p>
<hr />
<div>MDrivenServer will try and write exceptions to the eventlog.<br />
<br />
The eventlog may be restricted for the user running the MDrivenServer process. If this is the case you will see notes in MDrivenServer logs that is unable to write to eventlog.<br />
<br />
To fix you must allow the MDrivenServer process user access. Follow the solution here: https://stackoverflow.com/questions/1274018/system-security-securityexception-when-writing-to-event-log<br />
<br />
# Open the Registry Editor:<br />
## Select <code>Start</code> then <code>Run</code><br />
## Enter <code>regedt32</code> or <code>regedit</code><br />
# Navigate/expand to the following key: <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Tip: I set the permission on the whole EventLog node</code><br />
# Right click on this entry and select Permissions<br />
# Add the <code>Network Service</code> user, or to the user running the AppPool<br />
# Give it Read permission</div>Henrikhttps://wiki.mdriven.net/index.php?title=Documentation:Precision&diff=5559Documentation:Precision2020-08-21T10:58:47Z<p>Henrik: </p>
<hr />
<div>Precision, scale, and Length in property inspector for an class attribute. <br />
<br />
The Precsion, scale and Length attributes are managed using Transact SQL. Please see the SQL Server documentation for details</div>Henrik