webservice

kuponutcomkuponutcom Posts: 17
edited November 2, 2006 5:10AM in SQL Toolkit Previous Versions
http://www.red-gate.com/messageboard/vi ... tification

the above thread seems to be identical to my setup and error issue

yet, i have uploaded my local computer's working version of the licx and lic files to the server solution which is resulting in the error (listed below)

am i missing a step?


stacktrace error below

System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at _23._1(Type , Object , Boolean )
at _40.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at RedGate.SQLCompare.Engine.Database..ctor()

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    The bottom line is that what you are trying to do doesn't work. If you create a web application or webservice using SQL Toolkit, then the dialog box that needs to be shown cannot be displayed because web applications do not support Windows Forms windows.

    There is a workaround for this. The steps are:
    • Open Visual studio open one of the example applications in c:\program files\red gate\sql bundle 5\toolkit sample files.
    • Add a new text file to the project (licenses.licx) and configure it to be an embedded resource. Put the information that you normally need to enter in licenses.licx and save the file.
    • Build the project.
    • During the build, you should be prompted for your serial number.
    • Look for the SQL Toolkit_v5.lic file in the toolkit sample project's BIN\Debug (or release) folder.
    • Copy this and paste it into the BIN\Debug (or release) folder of your web project.
    • Load your web project and duild it. The error shouldn't appear because the licensing information is automatically transferred from your .lic file into your .NET assembly without the need for the licensing component to prompt for a serial number.

    If you are developing in VS 2005, there could be other problems because all web applications are dynamically compiled. In this case, you're better off separating the Toolkit functionality into its' own side-by assembly and calling it from your web application code.
  • The bottom line is that what you are trying to do doesn't work

    well, it does work... just locally. need help figuring out why it doesnt work live:


    my local environment: i'm using visual web express, sql toolkit 5, asp.net 2.0... the web service i have running locally uses sql 2005 database connections with integrated security = true. the webservice compares (sql compare) 2 local databases and updates one of them. its works like a charm.

    the .lic file generated by the sample toolkit, and me having provided the correct serial key for it when prompted, everything works locally...

    the issue:

    when i upload my webservice stuff to the live server, which does include the licenses.licx and sql toolkit.lic 2 files that are within the webservice project, i get this "license" error (posted in first post of this thread).

    what I understand thus far is that the only thing that should matter when it comes to licensing, is that I must include the 2 licx and lic files, and the 2 RedGate .dll files (redgate.sql.shared, redgate.sqlcompare.engine) , which are in my project like this:
    /bin/SqlToolkit.lic
    /bin/RedGate.SQLCompare.Engine.dll
    /bin/RedGate.SQL.Shared.dll
    /licenses.licx

    these lic and licx files were generated locally, not on the server, were ftp uploaded to the server webservice location folder.

    sql compare is not installed, neither is sql toolkit, on the live server.


    if the lic and licx files work locally, why arent they working live? its the same files, the dll files are there.


    i appriciate your patience with all my posts for help over the last several weeks, look forward to more of your replies ;)
  • and wouldnt the stack trace error (as posted in the first post of this thread) suggest this issue is really a license issue, the true underlying issue is due to a license problem... see the strack trace line error:

    at _40.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)

    i'm assuming that the modal dialogue error merely exists because its trying to inform me there is a license problem, but has nowhere to spit out the license error (expecting a dialogue box)?
  • everything seems to be working fine now live, now that i've done the following:

    - downloaded VS2k5 trial so i would have something to compile with on live server
    - downloaded sql toolkit 5 on live server
    - compiled toolkit sample
    - provided serial key

    and now it works
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    I sort-of hinted at this earlier: if this web application is running on .NET Framework 2.0, the application is dynamically-compiled. That means that the .lic file needs to be produced on the web server (by compiling the example application) so that it can be picked up and used whenever the code is compiled. The licence needs to produced on the web server in this case because the licence activations are machine-specific and the .lic file from your development machine will not be valid on the web server machine.

    On ASP .NET 1.1, you use Visual Studio to build a pre-compiled dll on your development machine and deploy this to your web server. If the licensing worked correctly, there is no need at all to produce a .lic file on the webserver machine; the licence is included in the pre-compiled assembly.

    This is why I hinted at wrapping the Toolkit functionality into a separate dll if you are using Toolkit in an ASP .NET 2.0 web application. That would negate the need to produce a .lic file on the webserver.

    I'm sorry that this is so complicated!
This discussion has been closed.