Access Denied error while reading from filestream

Hi Everyone.
I have an intranet application that stores files in SQL filestream.
On my dev machine, everything works like a charm.
I'm able to upload and store files into SQL filestream (AjaxUpload) and able to downlaod them.
On the live server, I'm able to upload files, delete them, but when I try to download the file from filestream, 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.ComponentModel.Win32Exception: Access is denied
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:
[Win32Exception (0x80004005): Access is denied]
System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize) +1465594
System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize) +398
System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access) +27
quotes_GetFileStream.quotes_GetFileStream_Load(Object sender, EventArgs e) +740
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048
The application pool is set to integrated, V.4.0,  and I use a domain user for the identity authentication back to SQL.
I gave that user DB_Owner rights to the SQL Database for that application.
Even tried giving it all the SQL Server Roles, though i still get the above error.
When I change the Identity username to mine (I have Domain Admin rights), everything works flawlessly on the live server.
What rights am I missing to give that user so he can read from SQL filestream properly.
Here is the block of code that gets the file from filestream and pushes it to the browser, maybe I'm missing something here (though once i modify the user it works great).
Dim RecId As Integer = -1
If Not IsNothing(Request.QueryString("ID")) And IsNumeric(Request.QueryString("ID")) Then
RecId = CType(Request.QueryString("ID"), Integer)
End If
Dim ConString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ToString
Using Con As SqlConnection = New SqlConnection(ConString)
Con.Open()
Dim txn As SqlTransaction = Con.BeginTransaction()
Dim Sql As String = "SELECT FileData.PathName() , GET_FILESTREAM_TRANSACTION_CONTEXT() as TransactionContext, [FileName], [FileExtension] FROM [QAttach] where RecId = @RecId"
Dim cmd As SqlCommand = New SqlCommand(Sql, Con, txn)
cmd.Parameters.Add("@RecID", Data.SqlDbType.Int).Value = RecId
Dim Rdr As SqlDataReader = cmd.ExecuteReader()
While Rdr.Read()
Dim FilePath As String = Rdr(0).ToString()
Dim objContext As Byte() = DirectCast(Rdr(1), Byte())
Dim fname As String = Rdr(2).ToString()
Dim FileExtension As String = Rdr(3).ToString()
Dim sfs As SqlFileStream = New SqlFileStream(FilePath, objContext, FileAccess.Read)
Dim Buffer As Byte() = New Byte(CInt(sfs.Length) - 1) {}
sfs.Read(Buffer, 0, Convert.ToInt32(Buffer.Length))
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = FileExtension
Response.AddHeader("content-disposition", "attachment;filename=" & fname)
Response.BinaryWrite(Buffer)
Response.Flush()
Response.End()
sfs.Close()
End While
End Using
Thanks.
Oren

@William Bosacker:
Please accept our apologies for any mistreatment.  While there's certainly no legal recourse for posts on an open forum like this, we do take steps to try to keep the forums a pleasant and friendly place to visit, and toward this end, two other moderators
have already cleaned the thread and have begun to address the abuse.
Not to defend the manner in which it was addressed, I must still point out that necro posting to a thread (this thread is from late 2013) and proposing your post as an answer are both generally discouraged. Again, I cannot condone the way in which it was
presented, but I can understand why the other contributors thought something should be said.
The recommended way to contribute information like this would be to create a new Discussion thread with content something like:
"I was experiencing XYZ issue and while searching for a resolution I found this thread [link to old thread].  But after trying A, B, and C, I found that the following actually resolved my problem [code snippet].  I thought this might be helpful
for anyone else with this issue... yada yada"
In the case of this original thread, the issue was most certainly permission related.  While the underlying network permissions would certainly need to allow that user to access the server, the root problem may well have been within the SQL table permissions
themselves.  The OP of the original thread really didn't provide enough context to know if they had the internal database permissions set correctly.
The information you've provided essentially shows one way to set the table permissions, but it isn't necessarily the only way.  Its also possible that the issue could be resolved by modifying permission entries within the SQL manager rather than through
a particular script file.  So while this information may indeed be helpful to someone in the future, it does not necessarily answer the question of this thread.  Only the OP has enough information to know if this can be applied to their situation;
and since the thread is several years old and was originally closed by a moderator, there is very little chance that the OP will be back to respond.
Hopefully this clears the air a little and will allow us all to get back to trying to help the VB development community within the guidelines of the forum.
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

Similar Messages

  • Getting access denied error while importing file using input type="file"

    Hi All,
    I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like:
    <input type="file" id="uploadFile" name="uploadFile" size="50">
    I have the import button on which I have used onClick event to call javascript function submitValues() used to validate all the fields from the page which goes like:
    <input type="button" name="select" value="Import" class="CSSButton" onClick="javascript:submitValues();">
    The JS function then in turn submits the form and calls the action.The problem is sometimes even when the correct path is specified for the file to be imported results in access denied error.This error comes sometimes and other times it works fine.But when this error comes,I need to relogin into the application and then it works fine.I am using IE7 for this.
    Any idea why I am getting access denied error while importing? Has it got something to do with IE7 version or with the input type="file" which is being used here?
    Thanks for any help if anyone can provide.
    Edited by: passionateforjava on Mar 4, 2009 2:18 AM

    vishnuS1984 wrote:
    Hi Friends,
    I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class...So let's see... C:\GetMe1 is a directory on your machine, right? And this is what you are doing with that directory:
    public static void copyFiles(File src, File dest) throws IOException
    // dest is a 'File' object but represents the C:\GetMe1 directory, right?
    fout = new FileOutputStream (dest);If it's a directory, where in your code are you appending the source file name to the path, before trying to open an output stream on it? You're not.
    BTW, this is awful:
    catch (IOException e)
    IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
    src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
    wrapper.initCause(e);
    wrapper.setStackTrace(e.getStackTrace());
    throw wrapper;
    }1) You're hiding the original IOException and replacing it with your own? For what good purpose?
    2) Even if you had a good reason to do that, this would be simpler and better:
    throw new IOException("your custom message goes here", e);
    rather than explicitly invokign initCause and setStackTrace. Yuck!

  • Access Denied Error while accessing "Site Settings Access requests and invitations"

    Hi,
    I am getting Access Denied Error while accessing "Site Settings > Access requests and invitations" in SharePoint  2013 online. Currently I am the owner of the site and have "FULL CONTROL" access. I am able to access using
    site collection account. So, what permission I have to give my regular account to access this page?
    Thanks, Pal

    Hello,
    Have you recently changed the Owners group of the site collection or removed the user from the original owners group? 
    The reason I am asking is when the Access requests and invitations list are created, the permissions are given only to the default owners group at the time that the Access Request list was created.  If this "regular account" is not part of that owners
    group, the user will receive access denied.  Site Collection Admins always have permissions for the Access Request List.
    A workaround for the Access Denied issue is listed in the KB article http://support.microsoft.com/kb/2911390/en-us.  By giving the correct group or user the permissions to this list, the users will not receive
    the Access Denied issue anymore.  
    Preferably, in order to grant the user the full permissions ( you will see features like resending invitations may still fail after implementing the above workaround) there is one other workaround that may be required depending on what the original issue
    was.  Below are additional steps to restore full functionality.
    1)Access the /_layouts/15/permsetup.aspx of the site collection, make sure the default Owners Group
    is set correctly.  (There is a group selected)
    2) Add user to that Owners Group.  (Issue may be resolved at this step if the site collection Owners
    Group was never changed, if not continue to next step.)
    3) Implement workaround on http://support.microsoft.com/kb/2911390/en-us, by adding that owners
    group as Full control on Access Request list Permissions.
    Let me know how this works out for you.
    - Shpendi Jashari

  • Timerjob Access denied error while opening web object

    Hi Team,
    I have created a timer job to get list information on the site. Everything is fine in the development(Stand alone server) . Got access denied error while running same timer job in QA server(one app and one WFE).
    Note: This timer job is globally deployed.
    Code snippet : 
    SPSite site1 = webApp.Sites[0];
    SPWeb web = site1.RootWeb;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(site1.ID))
    using (SPWeb currWeb = site.OpenWeb(web.ID))                  // Got access denied error here.
    Additional information:
    Sharepoint timer service account : Domain\SP_Farm
    Site app pool account : Domain\SP_App.
    Both accounts have site collection administrative access on the site. Do i need to check access permissions on DB level also  this error ?
    Waiting for urgent reply..

    Hi,
    1. Please check the link below:
    Fixing Access Denied Errors With SharePoint 2010 Timer Jobs
    http://www.sharepointsecurity.com/sharepoint/sharepoint-security/fixing-access-denied-errors-with-sharepoint-2010-timer-jobs/
    2. Try to set RemoteAdministratorAccessDenied  to false using PowerShell
    Access denied when deploying a timer Job or activating a feature from SharePoint 2010 content web application
    https://support.microsoft.com/kb/2564009?wa=wsignin1.0
    3. Check your ULS log for detail error message.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Message failing in SXMB_moni----Error while reading from the secure store

    Hi,
    The scenario is as below
    A file is picked up from a folder and processed to enrich it.This enriched file is then written back in a different folder.
    The message is failing in sxmb_moni while trying to write the file in the folder.
    The PI system is a system copy of another system and few of the configuration objects are transported through a tpz file to this PI system.The file receiver channel used to write this file is also transported through this tpz file.
    Below is the error seen in moni.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Call Adapter --> <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"><SAP:Category>XIServer</SAP:Category><SAP:Code area="INTERNAL">AE_DETAILS_GET_ERROR</SAP:Code><SAP:P1/><SAP:P2/><SAP:P3/><SAP:P4/><SAP:AdditionalText>Error while reading from the secure store: ERROR_U: No service user password found for Adapter Engine</SAP:AdditionalText><SAP:Stack>Error while reading access data (URL, user, password) for the Adapter Engine
    </SAP:Stack><SAP:Retry>M</SAP:Retry></SAP:Error>
    Below is Trace log:
    <Trace level="1" type="B" name="PLSRV_CALL_ADAPTER"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_PLSRV_IE_ADAPTER-ENTER_PLSRV">
    <Trace level="1" type="B" name="CL_XMS_PLSRV_CALL_XMB-CALL_XMS_HTTP"></Trace><!-- ************************************ -->
    <Trace level="1" type="T">error reading secstore:Error while reading from the secure store: ERROR_UNKNOWN: System-dependent data for entry  changed:  / (SECSTORE,031) </Trace>
    <Trace level="1" type="System_Error">Error while reading access data (URL, user, password) for the Adapter Engine  </Trace>
    </Trace>
    </Trace>
    <Trace level="1" type="System_Error">Error exception return from pipeline processing! </Trace>
    <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST"></Trace><!-- ************************************ -->
    Is this because  PI system is a system copy of another system ?
    Regards,
    Sneha

    Error while reading access data (URL, user, password) for the Adapter Engine
    Check out Michal's reply:
    Re: URL for Central Adapter Engine
    As you said there was a system copy it may be the case that some things were not configured properly

  • Access denied error for Read user in sharepoint 2010

    Hello,
    In sharepoint 2010 subsite a user with Read permission getting Access Denied error while login.
     Few points:
       1. Master pages are approved not in pending status.
       2. Site permissions are not inherited.
    Please suggest the way to resolve it.
    Thank You,
    Santosh_09

    Check below threads for troubleshooting access denied issue. You can use fiddler to trace what is causing access denied.
    http://sharepoint.stackexchange.com/questions/75263/user-has-correct-permissions-for-subsite-but-access-is-denied
    http://sharepoint.stackexchange.com/questions/41225/user-permissions-access-denied-sharepoint-2010
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • DPM encountered an error while reading from the recovery point used for recovery.

    Hi Guys I'm getting this error:
    DPM encountered an error while reading from the recovery point used for recovery. Either the recovery point no longer exists or, if you
    selected a share for recovery, the path to its contents is missing from the recovery point.  (265)
    The DPM Server is on Windows 2012 DPM is 2012R2 4.2.1273.0
    The Server being backed up is 2012 R2 with DPM Agent 4.2.1273.0
    The Server has 3 Data Volumes (C: Drive) and D and E its the D and E drive that i get this error if i try and recover data from DPM.  the C Drive is fine.  the D and E Drive are different
    in that 1 De-dupe is enabled and 2 the Shadow Copies for these Volumes are stored on separate Disks F and G respectively.
    I've removed the Protection from drives D and E and reinstated it but every recovery point created
    brings up the same error message. I'm not sure where to go next do I need to Protect the Disks that have the Shadow copies on also? Many thanks in advance Gordon.

    Hi,
    It seems you are in a configuration where the Windows 2012 based DPM server does not understand how to read Windows 2012 R2 Dedup data structure which is what the DPM replica volume is.
    See the DPM supported and unsupported scenarios
    here under the deduplication issues section. 
    We have a fix in DPM2012 R2 UR5 that will protect the Windows 2012 R2 dedup volume in a non-dedup state on the DPM Server, but unfortunately that will not allow previous recovery points to be read.
    KB3021791-Description of Update Rollup 5 for System Center 2012 R2 Data Protection Manager
    Backup job for dedupe-enabled volume on Windows 2012 R2 fails. For example, Data Protection Manager backup might fail for following setup:
    Data Protection Manager2012 R2 is installed on Windows Server 2012.
    Data Protection Manager is protecting a dedupe-enabled volume on Windows Server 2012 R2.
    This also applied to restores as the above was for D2D2T backup that may fail as it needs to read the recovery point to back it up to tape.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This
    posting is provided "AS IS" with no warranties, and confers no rights.

  • Access denied error while writing a file to the file system - myfileupload.saveas() throws system.unauthorizedexception

    hi,
    as part of my requirement , i have to perform read and  write  operations of  few files [ using the file upload control in my custom visual web part] and on submit button click.
    but while writing these files - with the help of  fileupload control - and when i use  myfileupload.saveas(mylocation);
    - i am saving these files into my D:\ drive of my server , where i am executing my code -, am getting access denied error.
    it throws system.unauthorizedexception.
    i have given full control on that folder where i was trying to store my attached files. and also  after following asp.net forums,
    i have added  iusr group added and performed all those steps such that, the file is saved in my D:\ drive.
    but unfortunately  that didnt happen.
    also
    a) i am trying the code with runwithelevatedprivileges(delegate() )  code
    b) shared the drive within the  d :drive where i want o save the files.
    c) given the full privieleges for the app pool identity- in my case , its
    network service.
    the  other strange thing is that, the same code works perfectly in  other machine, where the same sp, vs 2012  etc were installed .
    would like to know, any other changes/ steps i need to make it on this  server, where i am getting the  error.
    help is  appreciated!

    vishnuS1984 wrote:
    Hi Friends,
    I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class...So let's see... C:\GetMe1 is a directory on your machine, right? And this is what you are doing with that directory:
    public static void copyFiles(File src, File dest) throws IOException
    // dest is a 'File' object but represents the C:\GetMe1 directory, right?
    fout = new FileOutputStream (dest);If it's a directory, where in your code are you appending the source file name to the path, before trying to open an output stream on it? You're not.
    BTW, this is awful:
    catch (IOException e)
    IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
    src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
    wrapper.initCause(e);
    wrapper.setStackTrace(e.getStackTrace());
    throw wrapper;
    }1) You're hiding the original IOException and replacing it with your own? For what good purpose?
    2) Even if you had a good reason to do that, this would be simpler and better:
    throw new IOException("your custom message goes here", e);
    rather than explicitly invokign initCause and setStackTrace. Yuck!

  • Access denied error while trying to install graphics drivers

    Hello,
    I have a new toshiba laptop P70-A. I have installed windows 7 and the pc was working excellent up until now. Noticed yesterday that the nvidia automated system failed to install the new update. When I tried to install the new driver manually, even from the
    device manager, I got the access denied message. 
    A day now wasted reading all the possible causes and solutions but with no luck. Read all the forums and all the posts, tried almost everything. Below youll find everything I tried as a solution and failed.
    1.Disabled UAC
    2.Enabled the administrator account and trying to take control from there
    3.Run the subinacl and the reset.cmd
    4.Tried manually to take control the folder windows (and access denied while changing the rights)
    5. Scanned the system with everything there is available ( Kaspersky, MalwareBytes, RegCurePro, Tuneup Utilities, CCleaner) The system came out clean.
    6. Tried restoring the system to an earlier time (got again access denied error code 0x80070005)
    7. Checked all the group policies (all seem to be fine)
    8. Run a script to take immediate ownership over all of C:
    TAKEOWN /A /F C:
    then the next one
    TAKEOWN /F C: 
    9. With subinacl I run all the above scripts... (still nothing changed)
    @echo off
    title Resetting ACLs...
    echo.
    echo Determine whether we are on an 32 or 64 bit machine
    echo.
    if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86
    set ProgramFilesPath=%ProgramFiles(x86)%
    goto startResetting
    :x86
    set ProgramFilesPath=%ProgramFiles%
    :startResetting
    echo.
    cd /d "%ProgramFilesPath%\Windows Resource Kits\Tools"
    echo. 
    echo Resetting ACLs...
    echo (this may take several minutes to complete)
    echo. 
    echo IMPORTANT NOTE: For this script to run correctly, you must change
    echo the values named Athena to be the Windows user account that
    echo you are logged in with.
    echo.
    echo ==========================================================================
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=Athena=f /setowner=administrators > %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=Athena=f /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo System Drive...
    subinacl /subdirectories %ProgramFilesPath%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo Windows Directory...
    subinacl /subdirectories %windir%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo ==========================================================================
    echo. 
    echo FINISHED.
    echo. 
    echo Press any key to exit . . .
    pause >NUL
    Im frustrated really... ANY help at all would be really appreciated.
    Thanks in Advance and sorry for the long post
    Athena 

    Hello,
    Thanks for the replies, i much appreciate it. I tried all of the above with no luck again. Safe mode allows me though to install drivers but thats reverting the moment im entering windows. Im always running commands and programs as a administrator or in
    the Admin enabled account.
    It seems the problem is solved today. Via tune up utilities I disabled most of the startup programs and services and it seems that 1 service is causing this issue. Although I havent played much with the disabled services but 3 remain to be checked. One of
    the three is causing this.
    Thanks again guys and Ill keep you posted about the soft. conflict.
    Athena

  • Access denied Error while calling Web Service form Infopath Form 2010.

    Hi Dear All,
    I have been facing an error while calling an GetUserProfileByName() web service method from InfoPath 2010 from.
    i have FBA(Forms Base Authentication )configured . After Infopath form published to site collection when i select an user from people picker control i want to get Email Id of Selected user for that i am calling getUserProfileByName() Web Method, but 
    i am getting Access denied error code 500.
    Any Help would be more than welcome.
    Thanks.

    Hi,
    Greetings. Please check 
    Check the IE settings. Click Internet Options> Security>Custom level. Make sure that the ‘Access data source across domains’ is enabled. Make sure that you have permission to the web service and to the content which the web service tries to modify.
    For more information, please refer to this site:
    "Access is denied." error in Infopath 2007 form + ASMX: http://us.generation-nt.com/answer/access-denied-error-infopath-2007-form-plus-asmx-help-65808252.html
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • "general access denied error" while implementing out-of-process COM Server Implementation in Windows Phone 8.1

    I have a Service (.exe) where I was registering for my COM Component like below
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0);
    if (hres != S_OK)
    OutputDebugStringA("Security Descriptor not initialized");
    ITypeLib* pTypeLib;
    HRESULT hr_1 = LoadTypeLibEx(L"ServiceIdl.tlb", REGKIND_REGISTER, &pTypeLib);
    if (pTypeLib != NULL)
    pTypeLib->Release();
    RegisterServer(L"Service.exe", CLSID_classAImpl, L"ClassAImpl Sample", L"Component.ClassAImpl", L"Component.ClassAImpl.1", 0);
    g_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    DWORD reg = 0;
    IClassFactory *pIFactory = new classAFactory;
    HRESULT hr0 = CoRegisterClassObject(CLSID_classAImpl, pIFactory, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &reg);
    if (FAILED(hr0))
    OutputDebugStringA("classAImpl is not registered");
    CoUninitialize();
    exit(1);
    HRESULT hr1 = CoResumeClassObjects();
    if (hr1 == S_OK)
    OutputDebugStringA("classAImpl is Resumed Registering");
    WaitForSingleObject(g_hEvent, INFINITE);
    CloseHandle(g_hEvent);
    CoRevokeClassObject(reg);
    pIFactory->Release();
    CoUninitialize();
    From Client Code I am CreatingInstance  Like Below
    COSERVERINFO si;
    MULTI_QI qi;
    COAUTHINFO cai = { RPC_C_AUTHN_NONE, RPC_C_AUTHZ_NONE, 0, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, 0, EOAC_NONE };
    si.dwReserved1 = 0;
    si.pwszName = L"\\\\localhost";
    si.pAuthInfo = &cai;
    si.dwReserved2 = 0;
    qi.pIID = &IID_classA;
    qi.pItf = NULL;
    qi.hr = 1;
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hr = CoCreateInstanceEx(CLSID_classAImpl, 0, CLSCTX_LOCAL_SERVER, &si, 1, &qi);
    hr returning error "general access denied error";

    I think we may run into the limitations mentioned in the remarks of CoCreateInstanceFromApp doc(show as below). If you can provide a repro project, I
    can give you more details about what happens.
    The CoCreateInstanceFromApp function reads class registrations only from Fusion contexts and manifests, and from the HKLM\SOFTWARE\Classes\CLSID registry hive.
    Only built-in classes that are supported in the app container are supplied. Attempts to activate unsupported classes, including all classes installed by 3rd-party code as well as many Windows classes, result in error code
    REGDB_E_CLASSNOTREG.
    The CoCreateInstanceFromApp function is available to Windows Store apps. Desktop applications can call this function, but they have the same restrictions as Windows Store apps.
    If you are trying to call some windows classes in your library, I will suggest you check how to create windows runtime out of process component by viewing
    this sample. This is what I usually do.
    To be honest, I did not try to implement the out of process COM component using the method you tried as we previsouly do on desktop. I will suggest you try to register a very simple library(like a signle class and single interface which returns an integer),
    and see if it will work.
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

  • Access denied error while exporting chart to excel

    I need to export data from a gridview to chart in excel. Through system account credentials it works fine. But through a user's credentials its giving an access denied error. The gridview data is exported properly but the current chart which is displayed
    on page is not getting displayed in excel.
    So is there any other way to achieve this?
    I was thinking og saving it to virtual folder in the Site but I cannot figure out the exact code for it. Since file upload control is not involved, how to save the chart to the virtual folder. Any inputs on this?

    Hello,
    Would you mind if you use "runwithelevatedprivileges" in your code to execute code with admin privilege?
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
    >I was thinking og saving it to virtual folder in the Site
    Do you want to save excel in system folder or SP site folder?
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Error while reading from device

    I just upgraded from a 3gs to the iPhone 4 32GB. I upgraded to the newest iTunes. The phone is still using iOS 4.0.
    When syncing large movies that worked fine on the 3gs, I get the message "Attempting to copy to the "my phone name" failed. An error occured while reading from the device.
    Everything else synced fine, and some small homemade movies synced fine. Just the 2 that I had installed from "data discs" I got with DVDs won't sync. They play fine in iTunes.
    Any thoughts????
    Gene

    Problem solved... after reading around on the Internet I tried some ideas. The one that fixed the problem was the fact that I had a 6 foot usb extension cable on my system (not front facing usb ports). I plugged the iPhone data cable directly into the back of the PC and it fixed the issue.
    Thanks
    Gene

  • Oracle Migration Tool giving Access denied error for Read operation

    Hi;
    Oracle Migration tool is giving access denied error when we are trying to Read a record for Access Profiles.
    We are getting (SBL-ODS-50085) error.This is happening only for few records(Access Profiles).
    Although the user role is administrator having full access and privilege (Manage User and Access checked).
    Pl. help me resolve the issue.
    Thanks!

    Hi,
    Does it happen when you try to read "any" Access Profile?
    If yes, please have a look at the
    "Admin: Users and Access Controls - Manage Users and Access - Manage Users and establish User Quotas. Define Access Profiles, Roles and Groups to manage data access controls." privilege in the role of the user you use for migration.
    In order to avoid any problem, I usually create a "Migration" role temporarily and assign this role ALL the privileges to avoid such failures at the time of export.
    Hope this helps,
    Best regards,
    Charles DUBANT.
    http://www.dubant.com/

  • Two forests trusted "Access denied error" while RDP

    Hi Everybody,
    I have two forests 
    for ex:
    TestA & TestB
    I have created one Global group called "XYZ" in 'TestA' forest and added the users. 
    Both the forests are trusted. 
    In 'TestB' forest i have two servers. Computer1 & Computer2
    I have added "XYZ" group from "TestA" to Local administrators group of "TestB" and these groups are in restricted groups.
    Iam able to access upn \\computer1\C$ from TestA forest. But when i am trying to RDP to "Computer1" iam getting Access Denied error.
    Computer1 is (2008 R2) and forest & domain functional lever is 2003
    Kindly advise on this issue.
    Thanks!!

    Hi,
    I assume you don't have RDSH role installed.
    Have a look here
    This post is provided AS IS with no warranties or guarantees, and confers no rights.
    ~~~
    Questo post non fornisce garanzie e non conferisce diritti

Maybe you are looking for

  • Changing OSM task state/status from another parallel task flow

    Hi, guys! I have a problem with implementing parallel task flow. Let's consider such situation: there are two parallel task flows, the first flow contain manual task, upon completion which I need to change second flow's task state/status and vice-ver

  • Role Mapper and Authorizer

    At one point I posted a forum entry and posted a solution for my entry regarding keeping the app deployments around while recreating/overwriting the domain using WLST offline. Keep App Deployments while recreating the domain in WLST offline Things se

  • Trying to buy something off a game and it says this transfer cannot be completed contact itunes for assistance

    hi i have been trying to purchase something from an app and it tells me "this purchase cannot be completed please contact itunes for assistance

  • How nodemanager starts managed servers?

    Hello All, I'm facing strange issue with weblogic server. Currently i'm using WLS 8.1 SP 4 on solaris 9 server. To start weblogic i have customize the script such that when server goes on reboot it will pick the startweblogic.sh script from /opt/bin

  • OMG, the application cannot be undeployed...

    The application cannot be undeployed from the admin console. The engine was restarted The weblogic was restarted Still cannot undeploy the application... The log was checked, some weird sql error "invalid column type" what can i do...................