Windows Azure SDK for .NET Configuration And The certificate's private key could not be accessed

公良鸿禧
2023-12-01

1. Windows Azure SDK for .NET Configuration

You can download everything from the following website:

http://www.microsoft.com/en-us/download/details.aspx?id=35448

1.1 Manual Installation

1)     On32-bit Platform

WindowsAzureAuthoringTools-x86.msi

WindowsAzureEmulator-x86.exe

WindowsAzureLibsForNet-x86.msi

WindowsAzureTools.LightSwitch.vs110.exe

WindowsAzureTools.VS100.exe

 

2)     On 64-bit Platform

WindowsAzureAuthoringTools-x64.msi

WindowsAzureEmulator-x64.exe

WindowsAzureLibsForNet-x64.msi

WindowsAzureTools.LightSwitch.vs110.exe

WindowsAzureTools.VS110.exe

1.2 Automated Install

You can get everything you need for Windows Azure development using the Web Platform installer:

VS 2010 SP1 (http://go.microsoft.com/fwlink/?LinkId=254269)

OR VS 2012

(http://go.microsoft.com/fwlink/?LinkID=254364)

Windows Azure Tools for Microsoft Visual Studio extend Visual Studio 2010SP1/ Visual Studio 2012 to enable the creation, configuration, building, debugging, running, packaging and deployment of scalable web applications and services on Windows Azure.

        Windows Azure™ is a cloud services operating system that serves as the development, service hosting and service management environment for the Windows Azure platform. Windows Azure provides developers with on-demand compute and storage services to host, scale, and manage web applications on the internet through Microsoft® datacenters.

      Windows Azure is a flexible platform that supports multiple languages and integrates with your existing on-premises environment. To build applications and services on Windows Azure, developers can use their existing Microsoft Visual Studio® expertise. In addition, Windows Azure supports popular standards, protocols and languages including SOAP, REST, XML, Java, PHP, Ruby, Node and Python.

1.3 Add Reference

When Loading the Web Project, the System may report errors such as:Error 2 The type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure'  (are you missing an assembly reference?)

We can solve it on the Visual Studio: Project -> Add Reference..->Browse

Select the file According to the below table:

  

Name

Path

Microsoft.WindowsAzure.Diagnostics.dll

C:\Program  Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\bin\plugins\diagnostics\Microsoft.WindowsAzure.Diagnostics.dll

Microsoft.WindowsAzure.ServiceRuntime.dll

C:\Program  Files\Microsoft SDKs\Windows Azure\.NET  SDK\2012-06\bin\runtimes\base\Microsoft.WindowsAzure.ServiceRuntime.dll

 

 

 

 

1.4 Problems

1)     Server Error in '/' Application.


Could not load file orassembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of thecurrent web request. Please review the stack trace for more information aboutthe error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system can not find the file specified.

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.


Assembly Load Trace: The following information can be helpful to determine why the assembly  'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

 

=== Pre-bind state information ===

LOG: User = FAREAST\t-shjin

LOG: DisplayName = Microsoft.WindowsAzure.ServiceRuntime,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

 (Fully-specified)

LOG: Appbase =  file:///E:/MS_CRM_Projects/RXD_CloudCRM_Main/IAPS China Go Big/Source/IAPS  Portal/IAPSPortal/

LOG: Initial PrivatePath =  E:\MS_CRM_Projects\RXD_CloudCRM_Main\IAPS China Go Big\Source\IAPS  Portal\IAPSPortal\bin

Calling assembly : Adxstudio.Xrm, Version=5.0.19.0,  Culture=neutral, PublicKeyToken=c631995a3208e720.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file:  E:\MS_CRM_Projects\RXD_CloudCRM_Main\IAPS China Go Big\Source\IAPS  Portal\IAPSPortal\web.config

LOG: Using host configuration file:

LOG: Using machine configuration file from  C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Post-policy reference:  Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35

LOG: The same bind was seen before, and was failed with hr  = 0x80070002.


Stack Trace:

 

[FileNotFoundException: Could not load file or assembly  'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system  cannot find the file specified.]

   Adxstudio.Xrm.Services.InternalEndpointUtil.GetRemoteEndpoints(Boolean  allRolesIncluded, String internalEndpointName, RoleConfiguration  roleConfiguration) +0

    Adxstudio.Xrm.Services.InternalEndpointUtil.SendRequest(Boolean  allRolesIncluded, String internalEndpointName, RoleConfiguration  roleConfiguration, Object message, String virtualPath) +323

    Adxstudio.Xrm.Services.InternalEndpointOrganizationServiceCache.RemoteRemove(OrganizationServiceCachePluginMessage  message) +190

   Adxstudio.Xrm.Services.RemoteOrganizationServiceCache.Remove(OrganizationServiceCachePluginMessage  message) +147

    Adxstudio.Xrm.Services.RemoteOrganizationServiceCache.Execute(OrganizationRequest  request, Func`2 execute, Func`2 selector, String selectorCacheKey) +243

    Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest  request, Func`5 execute, Func`2 selector, String selectorCacheKey) +152

    Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest  request, Func`2 selector, String selectorCacheKey) +273

    Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest  request) +186

    Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest  request) +46

    Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest  request) +180

    Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest  request, IList`1 results) +69

 

[SaveChangesException: An error occured while processing  this request.]

    Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions  options) +1855

    Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges() +60

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryAuthenticateContact(HttpContext  context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext,  OrganizationServiceContext serviceContext, String identityProvider, String  userName, Entity contact, SessionSecurityToken sessionSecurityToken, String  returnPath) +197

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryAuthenticateExistingContact(HttpContext  context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext,  OrganizationServiceContext serviceContext, String identityProvider, String  userName, Entity contact, SessionSecurityToken sessionSecurityToken) +277

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext  context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext)  +841

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext  context, WSFederationAuthenticationModule fam) +79

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext  context) +329

 

[FederationAuthenticationException: Federated sign-in  error.]

    Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext  context) +734

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  +341

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,  Boolean& completedSynchronously) +69

Solution:

We  should add correct version of Microsoft.WindowsAzure.ServiceRuntime.dll to  the Web Project. Here, I select the DLL on file of C:\Program Files\Microsoft  SDKs\Windows Azure\.NET  SDK\2012-06\bin\runtimes\base\Microsoft.WindowsAzure.ServiceRuntime.dll.

 

2)     The certificate's private key could not be accessed

The certificate's private key could not be accessed. Ensure the access control list (ACL) on the certificate's private key grants access to the application pool user.

Solution:

We have to give Permission to the group IIS the group IIS_IUSRS to the files located at %ALLUSERSPROFILE%\Microsoft\Crypto\RSA\MachineKeys.

3)     Could not loadfile or assembly Microsoft.Xrm.Sdk.

Could not load file or assembly'Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannotfind the file specified.

Description: An unhandled exception occurredduring the execution of the current web request. Please review the stack tracefor more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file orassembly 'Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannotfind the file specified.

Source Error:

 

 

Line 63:                  this.LoadData(query,  _service, conn);

Line 64:             }

Line 65:          }

Line 66:

Line 67:          private QueryExpression Build_Accout_Query()

 


Source File: C:\Users\t-shjin\documents\visual studio2010\Projects\WebApplication1\WebApplication1\Default.aspx.cs   Line: 65

Assembly Load Trace: The following information can be helpful to determine whythe assembly 'Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35' could not be loaded.

 

 

=== Pre-bind state information ===

LOG: User = FAREAST\t-shjin

LOG: DisplayName = Microsoft.Xrm.Sdk,  Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

 (Fully-specified)

LOG: Appbase =  file:///C:/Users/t-shjin/documents/visual studio  2010/Projects/WebApplication1/WebApplication1/

LOG: Initial PrivatePath =  C:\Users\t-shjin\documents\visual studio  2010\Projects\WebApplication1\WebApplication1\bin

Calling assembly : WebApplication1,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file:  C:\Users\t-shjin\documents\visual studio  2010\Projects\WebApplication1\WebApplication1\web.config

LOG: Using host configuration file:

LOG: Using machine configuration file from  C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Post-policy reference: Microsoft.Xrm.Sdk,  Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

LOG: The same bind was seen before, and was  failed with hr = 0x80070002.

 


Stack Trace:

 

 

[FileNotFoundException: Could not load file or  assembly 'Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system  cannot find the file specified.]

    WebApplication1._Default.ConnectDB() in  C:\Users\t-shjin\documents\visual studio  2010\Projects\WebApplication1\WebApplication1\Default.aspx.cs:65

    WebApplication1._Default.Page_Load(Object sender, EventArgs e) in  C:\Users\t-shjin\documents\visual studio  2010\Projects\WebApplication1\WebApplication1\Default.aspx.cs:138

    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,  EventArgs e) +51

    System.Web.UI.Control.OnLoad(EventArgs e) +92

    System.Web.UI.Control.LoadRecursive() +54

    System.Web.UI.Page.ProcessRequestMain(Boolean  includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Solutions:

In the solution  Explorer, expand References Node -> Right Click Microsoft.xrm.sdk, then  open its Properties dialog, In the Properties dialog, set Copy Local as True,  re-run the project.

 

4)     Control 'Table_GridView' of type 'GridView' mustbe placed inside a form tag with runat=server.

Description: An unhandled exceptionoccurred during the execution of the current web request. Please review thestack trace for more information about the error and where it originated in thecode.

Exception Details: System.Web.HttpException: Control 'Table_GridView' of type'GridView' must be placed inside a form tag with runat=server.

Source Error:

 
Line 192:            StringWriter tw = new StringWriter();
Line 193:            HtmlTextWriter hw = new HtmlTextWriter(tw);
Line 194:            gdw.RenderControl(hw);
Line 195:
Line 196:            if (!string.IsNullOrEmpty(title))


Source File: C:\Users\t-shjin\Documents\Visual Studio2010\Projects\WebApplication1\WebApplication1\Dispaly.aspx.cs    Line: 194

Stack Trace:

 
[HttpException (0x80004005): Control 'Table_GridView' of type 'GridView' must be placed inside a form tag with runat=server.]
   System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +9644732
   System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer, Boolean renderPanel) +46
   System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer) +33
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   WebApplication1.Dispaly.ExportToExcel(GridView gdw, String title) in C:\Users\t-shjin\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\Dispaly.aspx.cs:194
   WebApplication1.Dispaly.DownLoad_Button_Click(Object sender, EventArgs e) in C:\Users\t-shjin\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\Dispaly.aspx.cs:233
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9553178
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
 
Solution:

We should tell the compiler that the control is  rendered explicitly by overriding the VerifyRenderingInServerForm event,  then add the event to the code behind file. Refer below

C#

public override void  VerifyRenderingInServerForm(Control control)

{

    /* Verifies that the control is rendered */

}

 

 类似资料:

相关阅读

相关文章

相关问答