C# 关于使用Azure AD进行单次登录的错误

C# 关于使用Azure AD进行单次登录的错误,c#,asp.net,.net,azure,azure-active-directory,C#,Asp.net,.net,Azure,Azure Active Directory,我试图实现一个单一的登录应用程序后,教程在这里 我在azure中添加了一个active directory,并为此租户添加了一个用户。然后我在VS2013中构建了一个小应用程序。我使用组织帐户,输入域名,登录并创建项目。在创建项目时,弹出了一个对话框,上面写着 请求\u BadRequest:为资源“应用程序”的属性“identifierUris”找到无效值 我把它关上了。我试图在本地机器上运行该项目。它会有这样的信息 HTTP Error 500.19 - Internal Server E

我试图实现一个单一的登录应用程序后,教程在这里

我在azure中添加了一个active directory,并为此租户添加了一个用户。然后我在VS2013中构建了一个小应用程序。我使用组织帐户,输入域名,登录并创建项目。在创建项目时,弹出了一个对话框,上面写着

请求\u BadRequest:为资源“应用程序”的属性“identifierUris”找到无效值

我把它关上了。我试图在本地机器上运行该项目。它会有这样的信息

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.



Detailed Error Information:



Module
   IIS Web Core 

Notification
   Unknown 

Handler
   Not yet determined 

Error Code
   0x80070032 

Config Error
   The configuration section 'system.identityModel' cannot be read because it is missing a section declaration.  

Config File




Requested URL
   http:

Physical Path


Logon Method
   Not yet determined 

Logon User
   Not yet determined 

Request Tracing Directory
   D:\My Documents\IISExpress\TraceLogFiles\ 




Config Source:
   34:   </system.web>
   35:   <system.identityModel>
   36:     <identityConfiguration>




More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file. 
View more information »
HTTP错误500.19-内部服务器错误
无法访问请求的页面,因为该页面的相关配置数据无效。
详细错误信息:
单元
IIS Web核心
通知
未知的
处理者
尚未确定
错误代码
0x80070032
配置错误
无法读取配置节“system.identityModel”,因为它缺少节声明。
配置文件
请求的网页链接地址
http:
物理路径
登录方法
尚未确定
登录用户
尚未确定
请求跟踪目录
D:\My Documents\IISExpress\TraceLogFiles\
配置源:
34:   
35:   
36:     
更多信息:
当读取Web服务器或Web应用程序的配置文件时出现问题,就会发生此错误。在某些情况下,事件日志可能包含有关导致此错误的原因的更多信息。
如果看到文本“存在重复的'system.web.extensions/scripting/scriptResourceHandler'部分已定义”,则此错误是因为您正在.NET Framework 4中运行基于.NET Framework 3.5的应用程序。如果您正在运行WebMatrix,要解决此问题,请转到“设置”节点,将.NET Framework版本设置为“.NET 2”。您还可以从web.config文件中删除额外的部分。
查看更多信息»

关于如何解决这个问题有什么想法吗?

我不确定根本原因是什么(为什么您在创建项目时出现错误),但下面应该解决您在运行应用程序时看到的错误

web.config
部分中,需要定义
system.identityModel
部分。条目应如下所示:

<configSections>
  <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</configSections>