Search Results

Search found 237 results on 10 pages for 'interopservices'.

Page 5/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Accessing "Mapi32.dll" with C#. [not solved]

    - by Code Smack
    Hello, I am using VS 2008 C# Windows Application. I have this DLL Import I am trying to use. [DllImport("Mapi32.dll", PreserveSig = true)] private static extern void WrapCompressedRTFStream( [MarshalAs(UnmanagedType.Interface)] UCOMIStream lpCompressedRTFStream, uint ulflags, [MarshalAs(UnmanagedType.Interface)] out UCOMIStream lpUncompressedRTFStream ); public const uint MAPI_MODIFY = 0x00000001; public const uint STORE_UNCOMPRESSED_RTF = 0x00008000; I have a compressed string that is in CompressedRFTFormat. How do I pass the string into the WrapCompressedRTFStream? I do not understand what the method is expecting. I am trying to use it on a button. RichText1.text = WrapCompressedRTFStream(_CompressedRichText.ToString(),something,somethingelse); The first error I get is "cannot convert from 'string' to 'System.Runtime.InteropServices.UCOMIStream" I hope someone who understands this posts an answer that helps!

    Read the article

  • How to set up a Bitmap with unmanaged data?

    - by Danvil
    I have int width, height; and IntPtr data; which comes from a unmanaged unsigned char* pointer and I would like to create a Bitmap to show the image data in a GUI. Please consider, that width must not be a multiple of 4, i do not have a "stride" and my image data is aligned as BGRA. The following code works: byte[] pixels = new byte[4*width*height]; System.Runtime.InteropServices.Marshal.Copy(data, pixels, 0, pixels.Length); var bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); for(int i=0; i<height; i++) { for(int j=0; j<width; j++) { int p = 4*(width*i + j); bmp.SetPixel(j, i, Color.FromArgb(pixels[p+3], pixels[p+2], pixels[p+1], pixels[p+0])); } } Is there a more direct way to copy the data?

    Read the article

  • SharePoint: The template you have chosen is invalid or cannot be found.

    - by sridhar-guntur
    Exception in frmMPInstall.CreateSite: Microsoft.SharePoint.SPException: The template you have chosen is invalid or cannot be found. --- System.Runtime.InteropServices.COMException (0x81071E44): The template you have chosen is invalid or cannot be found. at Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String& bstrWebTemplate, Int32& plWebTemplateId) at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String& bstrWebTemplate, Int32& plWebTemplateId) --- End of inner exception stack trace At the time of Deploying the solution.It shows above error . It happed only in 64 bit processer. How to solve this problem help me please thanks.

    Read the article

  • Execute VBA Macro via C# Interop?

    - by Jon Artus
    Hi all, just wondering if anyone could suggest why I might be getting an error? I'm currently trying to execute a macro in a workbook by calling the Application.Run method that the interop exposes. It's currently throwing the following COM Exception: {System.Runtime.InteropServices.COMException (0x800A03EC): Cannot run the macro Macro1'. The macro may not be available in this workbook or all macros may be disabled. I've put the containing workbook in a trusted location, set all of the security settings to their minimum values, and trusted programmatic access to my object model. I'm entirely out of ideas and Google's failed me so far! Has anyone done this, or can you suggest anything which I could try? Many thanks!

    Read the article

  • Printing and exporting from Crystal Reports Viewer throws error

    - by MAW74656
    I'm using the .net Crystal Reports viewer to display a report. This works properly, but when I click on the print option, and then click "OK" on the options popup, I get the following error: Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Access is denied. And the same thing when I try to export. I'm running this on the Visual Studio development server, VS2008. What can I do to correct this?

    Read the article

  • SharePoint: The template you have chosen is invalid or cannot be found

    - by user231976
    Exception in frmMPInstall.CreateSite: Microsoft.SharePoint.SPException: The template you have chosen is invalid or cannot be found. --- System.Runtime.InteropServices.COMException (0x81071E44): The template you have chosen is invalid or cannot be found. at Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String& bstrWebTemplate, Int32& plWebTemplateId) at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String& bstrWebTemplate, Int32& plWebTemplateId) --- End of inner exception stack trace At the time of Deploying the solution.It shows above error . It happed only in 64 bit processer. How to solve this problem help me please thanks.

    Read the article

  • size of structures in .NET

    - by redpaladin
    My problem is very simple. My problem is to send a structure between a program in C to a C# program. I made a struct in C#: public struct NetPoint { public float lat; // 4 bytes public float lon; // 4 bytes public int alt; // 4 bytes public long time; // 8 bytes } Total size of the struct must be 20 bytes. When I do a sizeof() of this struct: System.Diagnostics.Debug.WriteLine("SizeOf(NetPoint)=" + System.Runtime.InteropServices.Marshal.SizeOf(new NetPoint())); The debug console shows: SizeOf(NetPoint)=24 But I expected to have 20 bytes. Why do I see a difference?

    Read the article

  • C#:Saving image to folder

    - by Meko
    HI. I know this is simple question but when I use FirstPersonTestImage.Save(IIdComboBox.Text + "-" + i + ".jpg"); it works and saves file to folder where is the .exe file . But I want to save it to specific folder like /photo/IO-66/ and tryed to use String StudentPath = PhotoPath + IGroupNoComboBox.Text + "/" + IIdComboBox.Text + "/" + IIdComboBox.Text + "-" + i + ".jpg"; FirstPersonTestImage.Save(StudentPath); BUt it gives An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll How can I solve this problem? Is is about folder path ? or using "/" ? EDIT Here My code for creating and checking existing or not folder if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim())) { Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()); } if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+ "/" + IIdComboBox.Text.ToString().Trim() + "/")) { Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+"/" + IIdComboBox.Text.ToString().Trim() + "/"); }

    Read the article

  • structure in .NET

    - by redpaladin
    My problem is very simple.. My problem is to send a structure beetween a program in C to a C# program.. I made a struct in C#: public struct NetPoint { public float lat; // 4 bytes public float lon; // 4 bytes public int alt; // 4 bytes public long time; // 8 bytes } Total size of the struct must be 20 bytes When i do a sizeof() of this struct System.Diagnostics.Debug.WriteLine("SizeOf(NetPoint)=" + System.Runtime.InteropServices.Marshal.SizeOf(new NetPoint())); The debug console show : SizeOf(NetPoint)=24 But i expected to have 20 bytes ? Why do I have a difference ? Thank you in advance

    Read the article

  • How to Specify AssemblyKeyFile Attribute in .NET Assembly and Issues

    How to specify strong key file in assembly? Answer: You can specify snk file information using following line [assembly: AssemblyKeyFile(@"c:\Key2.snk")] Where to specify an strong key file (snk file)? Answer: You have two options to specify the AssemblyKeyFile infromation. 1. In class 2. In AssemblyInfo.cs [assembly: AssemblyKeyFile(@"c:\Key2.snk")] 1. In Class you must specify above line before defining namespace of the class and after all the imports or usings Example: See Line 7 in bellow sample class using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;[assembly: AssemblyKeyFile(@"c:\Key1.snk")]namespace Csharp3Part1{ class Person { public string GetName() { return "Smith"; } }}2. In AssemblyInfo.cs You can aslo specify assembly information in AssemblyInfo.cs Example: See Line 16 in bellow sample AssemblyInfo.csusing System.Reflection;using System.Runtime.CompilerServices;using System.Runtime.InteropServices;// General Information about an assembly is controlled through the following// set of attributes. Change these attribute values to modify the information// associated with an assembly.[assembly: AssemblyTitle("Csharp3Part1")][assembly: AssemblyDescription("")][assembly: AssemblyConfiguration("")][assembly: AssemblyCompany("Deloitte")][assembly: AssemblyProduct("Csharp3Part1")][assembly: AssemblyCopyright("Copyright © Deloitte 2009")][assembly: AssemblyTrademark("")][assembly: AssemblyCulture("")][assembly: AssemblyKeyFile(@"c:\Key1.snk")]// Setting ComVisible to false makes the types in this assembly not visible// to COM components. If you need to access a type in this assembly from// COM, set the ComVisible attribute to true on that type.[assembly: ComVisible(false)]// The following GUID is for the ID of the typelib if this project is exposed to COM[assembly: Guid("4350396f-1a5c-4598-a79f-2e1f219654f3")]// Version information for an assembly consists of the following four values://// Major Version// Minor Version// Build Number// Revision//// You can specify all the values or you can default the Build and Revision Numbers// by using the '*' as shown below:// [assembly: AssemblyVersion("1.0.*")][assembly: AssemblyVersion("1.0.0.0")][assembly: AssemblyFileVersion("1.0.0.0")]Issues:You should not sepcify this in following ways. 1. In multiple classes. 2. In both class and AssemblyInfo.cs If you did wrong in either one of the above ways, Visual Studio or C#/VB.NET compilers shows following Error Duplicate 'AssemblyKeyFile' attribute and warning Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile' To avoid this, Please specity your keyfile information only one time either only in one class or in AssemblyInfo.cs file. It is suggested to specify this at AssemblyInfo.cs file You might also encounter the errors like Error: type or namespace name 'AssemblyKeyFileAttribute' and 'AssemblyKeyFile' could not be found. Solution. Please find herespan.fullpost {display:none;} span.fullpost {display:none;}

    Read the article

  • Windows Server 2008 R2 Server Manager not working -> mmc.exe crashes with System.IO.FileNotFoundException

    - by Aleja_Vigo
    Since some days ago I can't run the Server Manager, it fails like this: Descripción: Stopped working Firma con problemas: Nombre del evento de problema: CLR20r3 Firma del problema 01: mmc.exe Firma del problema 02: 6.1.7600.16385 Firma del problema 03: 4a5bc808 Firma del problema 04: System.Management Firma del problema 05: 2.0.0.0 Firma del problema 06: 4ca2baf0 Firma del problema 07: 32f Firma del problema 08: 12b Firma del problema 09: System.IO.FileNotFoundException Versión del sistema operativo: 6.1.7601.2.1.0.272.7 There are other strange syntoms in the SO: Hyper-V stopped working as well, fails to load any VM information The desktop icons rearrange themselves all the time, and always on boot, after I move them. I use now an app that remembers their position to restore it... Windows Update service dissapeared, along with BITS service, I managed to recover them and installed all updates availables today I'm going nuts looking for information about these errors. Solutions that didn't work: sfc /scannow Doesn't complain about anything All windows updates applied (after recovering missing Windows Update) ServerManager.log: Only one error all the time: Error (Id=0) System.Runtime.InteropServices.COMException (0x800706D9): No hay más extremos disponibles desde el asignador de extremos. (Excepción de HRESULT: 0x800706D9) en Microsoft.Windows.ServerManager.NativeMethods.INetFwPolicy2.IsRuleGroupCurrentlyEnabled(String group) en Microsoft.Windows.ServerManager.DirectResult.GetRemoteManagementEnabled() In english : "There are no more endpoints available from the endpoint mapper" Where could I see which is the infamous file that mmc.exe is looking for in that System.IO.FileNotFoundException?? Please, any light on this would be much appreciated...

    Read the article

  • How do you setup FTP with IIS Manager Users in an NLB environment with shared IIS configs?

    - by William Jens
    I've setup a 2 node NLB cluster and used the following to share IIS configs between them. http://blogs.technet.com/b/meamcs/archive/2012/05/30/configuring-iis-7-5-shared-configuration.aspx The IIS configs and content is located on a network share via a UNC path. This works - updating IIS settings on one node, is visible in another node and my website works on the individual nodes and the cluster as whole. I'm able to setup an FTP site and successfully connect with my Windows login. However, I want to use IIS Manager Authentication as defined in: http://www.iis.net/learn/publish/using-the-ftp-service/configure-ftp-with-iis-manager-authentication-in-iis-7 I've tried using "Network Service" with the FTP COM object as well as a dedicated user account that exists on all three hosts, but every time I try to login with an IIS user I get something like the following: IISWMSVC_AUTHENTICATION_UNABLE_TO_READ_CONFIG An unexpected error occurred while retrieving the authentication information. Exception:System.Runtime.InteropServices.COMException (0x8007052E): Filename: Error: at Microsoft.Web.Administration.Interop.AppHostWritableAdminManager.GetAdminSection(String bstrSectionName, String bstrSectionPath) at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath) at Microsoft.Web.Management.Server.ConfigurationAuthenticationProvider.GetSection(ServerManager serverManager) Process:dllhost User=NT AUTHORITY\NETWORK SERVICE Can anyone point me in the right direction here?

    Read the article

  • HELP PLEASE!!!! External component has thrown an exception. ASP.NET ASPX PAGE POST

    - by Brandon
    I have an aspx page that communicates with a webservice I have. It connects to an SQL Server database on my virtual dedicated server. With just a little usage, I get this error External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SEHException (0x80004005): External component has thrown an exception.] Luxand.FSDK.Initialize(String DataFilesPath) +0 WebService.onLoad() +70 WebService..ctor() +91 facematch.btn_submit_Click(Object sender, EventArgs e) +218 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    Read the article

  • External component has thrown an exception. ASP.NET ASPX PAGE POST

    - by Brandon
    I have an aspx page that communicates with a webservice I have. It connects to an SQL Server database on my virtual dedicated server. With just a little usage, I get this error External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SEHException (0x80004005): External component has thrown an exception.] Luxand.FSDK.Initialize(String DataFilesPath) +0 WebService.onLoad() +70 WebService..ctor() +91 facematch.btn_submit_Click(Object sender, EventArgs e) +218 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    Read the article

  • C# SMTP virtual server doesn't send mail [closed]

    - by ragaei
    I have got the following Exception : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. - System.Runtime.InteropServices.COMException (0x8004020F): The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for [email protected] --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags, invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) public static void SendEmail(string _FromEmail, string _ToEmail, string _Subject, string _EmailBody) { // setup email header . SmtpMail.SmtpServer = "127.0.0.1"; MailMessage _MailMessage = new MailMessage(); _MailMessage.From = _FromEmail; _MailMessage.To = _ToEmail; _MailMessage.Subject = _Subject; _MailMessage.Body = _EmailBody; try { SmtpMail.Send(_MailMessage); } catch (Exception ex) { if (ex.InnerException != null) { String str = ex.InnerException.ToString(); } } }

    Read the article

  • .NET file Decryption - Bad Data

    - by Jon
    I am in the process of rewriting an old application. The old app stored data in a scoreboard file that was encrypted with the following code: private const String SSecretKey = @"?B?n?Mj?"; public DataTable GetScoreboardFromFile() { FileInfo f = new FileInfo(scoreBoardLocation); if (!f.Exists) { return setupNewScoreBoard(); } DESCryptoServiceProvider DES = new DESCryptoServiceProvider(); //A 64 bit key and IV is required for this provider. //Set secret key For DES algorithm. DES.Key = ASCIIEncoding.ASCII.GetBytes(SSecretKey); //Set initialization vector. DES.IV = ASCIIEncoding.ASCII.GetBytes(SSecretKey); //Create a file stream to read the encrypted file back. FileStream fsread = new FileStream(scoreBoardLocation, FileMode.Open, FileAccess.Read); //Create a DES decryptor from the DES instance. ICryptoTransform desdecrypt = DES.CreateDecryptor(); //Create crypto stream set to read and do a //DES decryption transform on incoming bytes. CryptoStream cryptostreamDecr = new CryptoStream(fsread, desdecrypt, CryptoStreamMode.Read); DataTable dTable = new DataTable("scoreboard"); dTable.ReadXml(new StreamReader(cryptostreamDecr)); cryptostreamDecr.Close(); fsread.Close(); return dTable; } This works fine. I have copied the code into my new app so that I can create a legacy loader and convert the data into the new format. The problem is I get a "Bad Data" error: System.Security.Cryptography.CryptographicException was unhandled Message="Bad Data.\r\n" Source="mscorlib" The error fires at this line: dTable.ReadXml(new StreamReader(cryptostreamDecr)); The encrypted file was created today on the same machine with the old code. I guess that maybe the encryption / decryption process uses the application name / file or something and therefore means I can not open it. Does anyone have an idea as to: A) Be able explain why this isn't working? B) Offer a solution that would allow me to be able to open files that were created with the legacy application and be able to convert them please? Here is the whole class that deals with loading and saving the scoreboard: using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; using System.Runtime.InteropServices; using System.IO; using System.Data; using System.Xml; using System.Threading; namespace JawBreaker { [Serializable] class ScoreBoardLoader { private Jawbreaker jawbreaker; private String sSecretKey = @"?B?n?Mj?"; private String scoreBoardFileLocation = ""; private bool keepScoreBoardUpdated = true; private int intTimer = 180000; public ScoreBoardLoader(Jawbreaker jawbreaker, String scoreBoardFileLocation) { this.jawbreaker = jawbreaker; this.scoreBoardFileLocation = scoreBoardFileLocation; } // Call this function to remove the key from memory after use for security [System.Runtime.InteropServices.DllImport("KERNEL32.DLL", EntryPoint = "RtlZeroMemory")] public static extern bool ZeroMemory(IntPtr Destination, int Length); // Function to Generate a 64 bits Key. private string GenerateKey() { // Create an instance of Symetric Algorithm. Key and IV is generated automatically. DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create(); // Use the Automatically generated key for Encryption. return ASCIIEncoding.ASCII.GetString(desCrypto.Key); } public void writeScoreboardToFile() { DataTable tempScoreBoard = getScoreboardFromFile(); //add in the new scores to the end of the file. for (int i = 0; i < jawbreaker.Scoreboard.Rows.Count; i++) { DataRow row = tempScoreBoard.NewRow(); row.ItemArray = jawbreaker.Scoreboard.Rows[i].ItemArray; tempScoreBoard.Rows.Add(row); } //before it is written back to the file make sure we update the sync info if (jawbreaker.SyncScoreboard) { //connect to webservice, login and update all the scores that have not been synced. for (int i = 0; i < tempScoreBoard.Rows.Count; i++) { try { //check to see if that row has been synced to the server if (!Boolean.Parse(tempScoreBoard.Rows[i].ItemArray[7].ToString())) { //sync info to server //update the row to say that it has been updated object[] tempArray = tempScoreBoard.Rows[i].ItemArray; tempArray[7] = true; tempScoreBoard.Rows[i].ItemArray = tempArray; tempScoreBoard.AcceptChanges(); } } catch (Exception ex) { jawbreaker.writeErrorToLog("ERROR OCCURED DURING SYNC TO SERVER UPDATE: " + ex.Message); } } } FileStream fsEncrypted = new FileStream(scoreBoardFileLocation, FileMode.Create, FileAccess.Write); DESCryptoServiceProvider DES = new DESCryptoServiceProvider(); DES.Key = ASCIIEncoding.ASCII.GetBytes(sSecretKey); DES.IV = ASCIIEncoding.ASCII.GetBytes(sSecretKey); ICryptoTransform desencrypt = DES.CreateEncryptor(); CryptoStream cryptostream = new CryptoStream(fsEncrypted, desencrypt, CryptoStreamMode.Write); MemoryStream ms = new MemoryStream(); tempScoreBoard.WriteXml(ms, XmlWriteMode.WriteSchema); ms.Position = 0; byte[] bitarray = new byte[ms.Length]; ms.Read(bitarray, 0, bitarray.Length); cryptostream.Write(bitarray, 0, bitarray.Length); cryptostream.Close(); ms.Close(); //now the scores have been added to the file remove them from the datatable jawbreaker.Scoreboard.Rows.Clear(); } public void startPeriodicScoreboardWriteToFile() { while (keepScoreBoardUpdated) { //three minute sleep. Thread.Sleep(intTimer); writeScoreboardToFile(); } } public void stopPeriodicScoreboardWriteToFile() { keepScoreBoardUpdated = false; } public int IntTimer { get { return intTimer; } set { intTimer = value; } } public DataTable getScoreboardFromFile() { FileInfo f = new FileInfo(scoreBoardFileLocation); if (!f.Exists) { jawbreaker.writeInfoToLog("Scoreboard not there so creating new one"); return setupNewScoreBoard(); } else { DESCryptoServiceProvider DES = new DESCryptoServiceProvider(); //A 64 bit key and IV is required for this provider. //Set secret key For DES algorithm. DES.Key = ASCIIEncoding.ASCII.GetBytes(sSecretKey); //Set initialization vector. DES.IV = ASCIIEncoding.ASCII.GetBytes(sSecretKey); //Create a file stream to read the encrypted file back. FileStream fsread = new FileStream(scoreBoardFileLocation, FileMode.Open, FileAccess.Read); //Create a DES decryptor from the DES instance. ICryptoTransform desdecrypt = DES.CreateDecryptor(); //Create crypto stream set to read and do a //DES decryption transform on incoming bytes. CryptoStream cryptostreamDecr = new CryptoStream(fsread, desdecrypt, CryptoStreamMode.Read); DataTable dTable = new DataTable("scoreboard"); dTable.ReadXml(new StreamReader(cryptostreamDecr)); cryptostreamDecr.Close(); fsread.Close(); return dTable; } } public DataTable setupNewScoreBoard() { //scoreboard info into dataset DataTable scoreboard = new DataTable("scoreboard"); scoreboard.Columns.Add(new DataColumn("playername", System.Type.GetType("System.String"))); scoreboard.Columns.Add(new DataColumn("score", System.Type.GetType("System.Int32"))); scoreboard.Columns.Add(new DataColumn("ballnumber", System.Type.GetType("System.Int32"))); scoreboard.Columns.Add(new DataColumn("xsize", System.Type.GetType("System.Int32"))); scoreboard.Columns.Add(new DataColumn("ysize", System.Type.GetType("System.Int32"))); scoreboard.Columns.Add(new DataColumn("gametype", System.Type.GetType("System.String"))); scoreboard.Columns.Add(new DataColumn("date", System.Type.GetType("System.DateTime"))); scoreboard.Columns.Add(new DataColumn("synced", System.Type.GetType("System.Boolean"))); scoreboard.AcceptChanges(); return scoreboard; } private void Run() { // For additional security Pin the key. GCHandle gch = GCHandle.Alloc(sSecretKey, GCHandleType.Pinned); // Remove the Key from memory. ZeroMemory(gch.AddrOfPinnedObject(), sSecretKey.Length * 2); gch.Free(); } } }

    Read the article

  • solution for RPC_E_ATTEMPTED_MULTITHREAD error caused by SPRequestContext caching SPSites?

    - by kerray
    Hi, I'm developing a solution for SharePoint 2007, and I'm using SPSecurity.RunWithElevatedPrivileges a lot, passing in UserToken of the SystemAccount. After reading http://hristopavlov.wordpress.com/2009/01/19/understanding-sharepoint-sprequest/ I finally began to understand why I get these System.Runtime.InteropServices.COMException (0x80010102): Attempted to make calls on more than one thread in single threaded mode. (Exception from HRESULT: 0x80010102 (RPC_E_ATTEMPTED_MULTITHREAD)) errors, but there seems to be no solution - "known issue in the product" The article is more then a year old. I wasn't able to find anything more recent and helpful, but I was hoping maybe someone else has? My code goes like this SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite elevatedSite = new SPSite(web.Site.ID, web.Site.SystemAccount.UserToken)) { using (SPWeb elevatedWeb = elevatedSite.OpenWeb(web.ID)) { // some operations on lists and items obtained through elevatedWeb } } } The errors come up wherever such an elevated code is used, and more often when there are more users who use these functionalities, so I guess perhaps the elevated SPSite is getting cached and reused. Is there any way to solve this? If my understanding is correct, how to make Sharepoint forget about the cached SPSites, and use a fresh one instead? Thanks

    Read the article

  • Loading GeckoWebBrowser Exceptions

    - by Mostafa Mahdieh
    I get a strange exception when a window containing a GeckoWebBrowser is loaded. This is the exception message: An unhandled exception of type System.Runtime.InteropServices.COMException occurred in Skybound.Gecko.dll Additional information: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) This is the windows code: public partial class AddContents : Form { String path; public AddContents(String path) { this.path = path; InitializeComponent(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void AddContents_Load(object sender, EventArgs e) { geckoWebBrowser1.Navigate(path); } private int selId = 1; private bool updateMode = false; private void timer1_Tick(object sender, EventArgs e) { if (updateMode) update(); } private void geckoWebBrowser1_DocumentCompleted(object sender, EventArgs e) { timer1.Enabled = true; updateMode = true; } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { geckoWebBrowser1.Navigate("javascript:scrollToBookmark(" + treeView1.SelectedNode.Tag + ")"); TreeNode selected = treeView1.SelectedNode; TreeNode prev = selected.PrevNode; TreeNode next = selected.PrevNode; if (prev == null) upButton.Enabled = false; if (next == null) downButton.Enabled = false; } private void update() { geckoWebBrowser1.Navigate("javascript:updateSelText()"); GeckoElement el = geckoWebBrowser1.Document.GetElementById("sel_result_991231"); if (el != null) { textBox1.Text = el.InnerHtml; addButton.Enabled = !textBox1.Text.Trim().Equals(String.Empty); } } private void textBox1_Enter(object sender, EventArgs e) { updateMode = false; } private void geckoWebBrowser1_DomMouseDown(object sender, GeckoDomMouseEventArgs e) { updateMode = true; update(); } private void geckoWebBrowser1_DomMouseUp(object sender, GeckoDomMouseEventArgs e) { updateMode = false; } private void addButton_Click(object sender, EventArgs e) { geckoWebBrowser1.Navigate("javascript:addIdToSel()"); TreeNode t = new TreeNode(textBox1.Text); t.Tag = selId; treeView1.Nodes.Add(t); selId++; } }

    Read the article

  • Can't step into stored procedure on remote SQL Server 2008

    - by abatishchev
    I have a domain installed on virtual Windows Server 2008 x64. SQL Server 2008 Express x64 is running in Windows Server 2008 x64 and client on Windows 7 RTM x86. Both are into the domain. I'm starting both Visual Studio 2008 and SQL Server Management Studio 2008 under domain admin user. This account is a member of group sysadmin on SQL Server. Server has firewall exceptions for both TCP and UDP on ports 135-139 and 1433-1434. Visual Studio 2008 Remote debugger services is started on server and Domain Admins group is allowed to debug, When I'm starting debugging of a query in SMS I'm getting this error: Failed to start debugger Error HRESULT E_FAIL has been returned from a call to a COM component. (mscorlib) Program Location: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.SqlServer.Management.UI.VSIntegration.DebugSession.DebugCallbacks.OnSqlInitializeDebuggingEvent(ISqlInitializeDebuggingEvent sqlInitializeDebuggingEvent) at Microsoft.SqlServer.Management.UI.VSIntegration.DebugSession.DebugCallbacks.Microsoft.VisualStudio.Debugger.Interop.IDebugEventCallback2.Event(IDebugEngine2 debugEngine, IDebugProcess2 debugProcess, IDebugProgram2 debugProgram, IDebugThread2 debugThread, IDebugEvent2 debugEvent, Guid& riidEvent, UInt32 attribute) and Unable to access the SQL Server debugging interface. The Visual Studio debugger cannot connect to the remote computer. A firewall may be preventing communication via DCOM to the remote computer. Please see Help for assistance. and Unable to start program MSSSQL://server.mydomain.local/master/sys/=0 And when stepping-in into a stored procedure using VS I'm getting the first one and this: Exception from HRESULT: 0x89710016 What have I do?

    Read the article

  • Exception using Querytables in Excel Automation

    - by sam
    Hi, I'm using Automation to populate a range in Excel using a querytable.. However, when I try to add a querytable to the qorksheet I get an exception. I checked the connection string and its working fine.. Can some one please help me with this?? public void writeproc1() { try { Worksheet ws = (Worksheet)wb.Worksheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); Range rng = ws.get_Range("A1", "E14"); QueryTable qt = ws.QueryTables.Add("Data Source=(local)\\SQLEXPRESS;initial catalog=temp;Integrated Security=SSPI;", rng, "Select * From Table_1"); qt.RefreshStyle = XlCellInsertionMode.xlInsertEntireRows; qt.Refresh(false); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); } } Exception Thrown System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Microsoft.Office.Interop.Excel.QueryTables.Add(Object Connection, Range Destination, Object Sql) at tmp.Program.writeproc1() in ...Projects\tmp\tmp\Program.cs:line 25

    Read the article

  • SPException: Catastrophic failure (Exception from HRESULT: 0x8000FFF (E_UNEXPECTED) in Sharepoint

    - by BeraCim
    Hi all: I've been trying to programmatically copy custom content type and its custom columns from one web to another for some time now, and every time I get some sort of error or exception. After yet more tries, I received another strange and cryptic exception from Sharepoint after clicking onto a newly copied custom column in a custom content type. I checked the logs, and this is what I got: Failed to find the content type schema for ct-1033-0x1000blahblahblahcontenttypeId while caching feature data. Unknown SPRequest error occurred. More informationL 0x8000ffff Unable to locate the xml-definition for CType with SPContentTypeId '0x0100MorecontenttypeId', exception: Microsoft.SharePoint.SPException: Catastrophic failure(Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure... ... at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt 32 lcid, Object varIdBytes... It failed to find quite a few content type schema. I'm confused with what Sharepoint is trying to do here, and why a simple process of copying a custom content type from one web to another just wouldn't work in contrast to the information found on the web e.g. this. Appreciate any help to get over this problem. Thanks.

    Read the article

  • Crystal Reports - "A string is required here" formula error.

    - by George Mauer
    I have a command line utility that generates one simple crystal report. I recently updated the project from .NET 1.1 to .NET 3.5 using the Visual Studio 2008 migrator and am now getting an error that I had never received before. The problem is in the work_order formula which is as follows: stringVar nvl_ship_wrk_id := "0"; stringVar nvl_ship_wrk_seq := "0"; If Not IsNull({FeedBOLInput.ShipWrkId}) Then nvl_ship_wrk_id := {FeedBOLInput.ShipWrkId}; If Not IsNull({FeedBOLInput.ShipWrkSeq}) Then nvl_ship_wrk_seq := {FeedBOLInput.ShipWrkSeq}; nvl_ship_wrk_id & " - " & nvl_ship_wrk_seq; And the error is: - InnerException {"A string is required here. Error in File C:\\...\\temp_88c50533-02c6-4973-ae06-ed0ab1a603ac {0D5E96FB-038A-41C5-93A7-A9D199961377}.rpt: Error in formula <work_order>. 'stringVar nvl_ship_wrk_id := \"0\"; ' A string is required here."} System.Exception {System.Runtime.InteropServices.COMException} Does anyone have any idea what this can be? I'm out of clues. The dataset is coming in properly - and the error seems to point to a row which merely initializes a variable.

    Read the article

  • NUnit Test with WatiN, runs OK from and Dev10, But not from starting NUnit from "C:\Program Files (x

    - by judek.mp
    I have the following code in an Nunit test ... string url = ""; url = @"http://localhost/ClientPortalDev/Account/LogOn"; ieStaticInstanceHelper = new IEStaticInstanceHelper(); ieStaticInstanceHelper.IE = new IE(url); ieStaticInstanceHelper.IE.TextField(Find.ById("UserName")).TypeText("abc"); ieStaticInstanceHelper.IE.TextField(Find.ById("Password")).TypeText("defg"); ieStaticInstanceHelper.IE.Button(Find.ById("submit")).Click(); ieStaticInstanceHelper.IE.Close(); On right-clicking the project in Dev10 and choosing [Test With][NUnit 2.5], this test code runs with no problems ( Iahve TestDriven installed ...) When opening the NUnit from C:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0\nunit.exe" and then opening my test dll, the following text is reported in NUnit Errors and failures ... Elf.Uat.ClientPortalLoginFeature.LoginAsWellKnownUserShouldSucceed: System.Runtime.InteropServices.COMException : Error HRESULT E_FAIL has been returned from a call to a COM component. As an Aside ... Right-Clicking the source cs file in Dev10 and choosing Run Test, ... works as well. The above test is actually part of TechTalk.SpecFlow 1.3 step, I have NUnit 2.5.5.10112, installed, I have Watin 20.20 installed, I have ... & in my NUnit.exe.config and I have the following App.config for my test dll... (the start angle brakets habe beem removed ) configuration configSections sectionGroup name="NUnit" section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/ /sectionGroup /configSections NUnit TestRunner add key="ApartmentState" value="STA" / /TestRunner /NUnit appSettings add key="configCheck" value="12345" / /appSettings /configuration Anyone hit this before ? The NUnit test obviously runs in NUnit 2.5.5 of TestDriven but not when run outside of Dev10 and TesDriven ?

    Read the article

  • When programatically creating a new IIS web site, how can I add it to an existing application pool?

    - by Ian Robinson
    I have successfully automated the process of creating a new IIS website, however the code I've written doesn't care about application pools, it just gets added to DefaultAppPool. However I'd like to add this newly created site to an existing application pool. Here is the code I'm using to create the new website. var w3Svc = new DirectoryEntry(string.Format("IIS://{0}/w3svc", webserver)); var newsite = new object[] { serverComment, new object[] { serverBindings }, homeDirectory }; var websiteId = w3Svc.Invoke("CreateNewSite", newsite); site.Invoke("Start", null); site.CommitChanges(); <update Although this is not directly related to the question, here are some sample values being used above. This might help someone understand exactly what the code above is doing more easily. webServer: "localhost" serverComment: "testing.dev" serverBindings: ":80:testing.dev" homeDirectory: "c:\inetpub\wwwroot\testing\" </update If I know the name of the application pool that I'd like this web site to be in, how can I find it and add this site to it? <update 2 I've added the following based on Mark's answer below. var appPool = new DirectoryEntry(string.Format("IIS://{0}/w3svc/AppPools/{1}", webServer, appPoolName)); site.Properties["AppPoolId"].Value = appPool; I seem to have moved passed the "RPC" error message I was initially receiving. Now this is the error message I'm receiving: Error: System.Runtime.InteropServices.COMException (0x8000500C): Exception from HRESULT: 0x8000500C at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32 lnControlCode, String bstrName, Object vProp) at System.DirectoryServices.PropertyValueCollection.set_Value(Object value) at ProvisionIISWebsite.Query.CreateWebsite(String webServer, String serverComment, String serverBindings, String homeDirectory, String appPoolName) in C:\Users\irobinson\My Projects\ProvisionIISWebsite\Query.cs:line 104 at ProvisionIISWebsite.Query.Handle_GetData(EngineBase& caller, Boolean isSubQuery, String query, String filterField, String filterText, Debugger& debugWriter, Boolean isRendered, Int32 timeout, String customConnection) in C:\Users\irobinson\My Projects\ProvisionIISWebsite\Query.cs:line 36 </update 2

    Read the article

  • Has anyone installed NServiceBus onto a Microsoft clustered server?

    - by David
    I am trying to install NServiceBus onto a clustered win2k3 host. The configuration utility provided (runner.exe) throw some errors that I did not catch, and it now runs correctly. When running NServiceBus.Host.exe i am get this error repeatedly: System.Transactions.TransactionAbortedException: The transaction has aborted. --- System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. --- System.Runtime.InteropServices.COMException (0x8004D01B): The Transaction Manager is not available. (Exception from HRESULT: 0x8004D01B) at System.Transactions.Oletx.IDtcProxyShimFactory.ConnectToProxy(String nodeName, Guid resourceManagerIdentifier, IntPtr managedIdentifier, Boolean& nodeNameMatches, UInt32& whereaboutsSize, CoTaskMemHandle& whereaboutsBuffer, IResourceManagerShim& resourceManagerShim) at System.Transactions.Oletx.DtcTransactionManager.Initialize() --- End of inner exception stack trace --- at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException) at System.Transactions.Oletx.DtcTransactionManager.Initialize() at System.Transactions.Oletx.DtcTransactionManager.get_ProxyShimFactory() at System.Transactions.Oletx.OletxTransactionManager.CreateTransaction(TransactionOptions properties) at System.Transactions.TransactionStatePromoted.EnterState(InternalTransaction tx) --- End of inner exception stack trace --- at System.Transactions.TransactionStateAborted.CheckForFinishedTransaction(InternalTransaction tx) at System.Transactions.EnlistableStates.Promote(InternalTransaction tx) at System.Transactions.Transaction.Promote() at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction) at System.Transactions.TransactionInterop.GetDtcTransaction(Transaction transaction) at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, CursorHandle cursorHandle, IntPtr transaction) at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at System.Messaging.MessageQueue.Receive(TimeSpan timeout, MessageQueueTransactionType transactionType) at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.ReceiveMessageFromQueueAfterPeekWasSuccessful() in d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Msmq\MsmqTransport.cs:line 551 Has anyone successfully put NServiceBus onto a clustered server, if so, how did you get it working?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >