Asp.net 为什么SharePoint远程事件接收器引用azure web app中托管的.SVC的错误url

Asp.net 为什么SharePoint远程事件接收器引用azure web app中托管的.SVC的错误url,asp.net,azure,sharepoint,deployment,svc,Asp.net,Azure,Sharepoint,Deployment,Svc,我正在为我们的SharePoint online根团队站点构建远程事件接收器。我将遵循本链接中提到的主要方法。当我使用ngrok调试它并从VS2019运行它时,该方法工作得很好。但当我在azure web应用程序中部署RER时,RER停止工作。以下是该问题的详细信息:- 1-VS 2019内部>>创建新的asp.net web应用程序>>添加名为rer.svc的.svc 2-我使用此urlhttps://**.admin.sharepoint.com/_layouts/15/appregnew.

我正在为我们的SharePoint online根团队站点构建远程事件接收器。我将遵循本链接中提到的主要方法。当我使用ngrok调试它并从VS2019运行它时,该方法工作得很好。但当我在azure web应用程序中部署RER时,RER停止工作。以下是该问题的详细信息:-

1-VS 2019内部>>创建新的asp.net web应用程序>>添加名为rer.svc的.svc

2-我使用此url
https://**.admin.sharepoint.com/_layouts/15/appregnew.aspx

3-然后我从SP管理中心@
https://***-admin.sharepoint.com/_layouts/15/appinv.aspx访问应用程序
+我添加此权限:-

 <AppPermissionRequests AllowAppOnlyPolicy="true">
 <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
 </AppPermissionRequests>
所以从理论上讲,我应该让一切都运转良好。但当更新“项目系统”列表中的列表项时,RER没有任何效果。因此,我打开azure application server日志,更新列表项后,日志将显示以下错误:-

The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>IIS Detailed Error - 404.0 - Not Found</title><style type="text/css"><!--body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}.config_source code{font-size:.8em;color:#000000;}pre{margin:0;font-size:1.4em;word-wrap:break-word;}ul,ol{margin:10px 0 10px 5px;}ul.first,ol.first{margin-}fieldset{padding:0 15px 10px 15px;word-break:break-all;}.summary-container fieldset{padding-bottom:5px;margin-}legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;}legend{color:#333333;;margin:4px 0 8px -12px;_margin-font-weight:bold;font-size:1em;}a:link,a:visited{color:#007EFF;font-weight:bold;}a:hover{text-decoration:none;}h1{font-size:2.4em;margin:0;color:#FFF;}h2{font-size:1.7em;margin:0;color:#CC0000;}h3{font-size:1.4em;margin:10px 0 0 0;color:#CC0000;}h4{font-size:1.2em;margin:10px 0 5px 0;}#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS",Verdana,sans-serif;color:#FFF;background-color:#5C87B2;}#content{margin:0 0 0 2%;;}.summary-container,.content-container{background:#FFF;width:96%;margin-padding:10px;;}.content-container p{margin:0 0 10px 0;}#details-left{width:35%;float:left;margin-right:2%;}#details-right{width:63%;float:left;}#server_version{width:96%;_height:1px;min-height:1px;margin:0 0 5px 0;padding:11px 2% 8px 2%;color:#FFFFFF;background-color:#5A7FA5;border-bottom:1px solid #C1CFDD;border-font-weight:normal;font-size:1em;color:#FFF;text-align:right;}#server_version p{margin:5px 0;}table{margin:4px 0 4px 0;width:100%;border:none;}td,th{vertical-align:top;padding:3px 0;text-align:left;font-weight:normal;border:none;}th{width:30%;text-align:right;padding-right:2%;font-weight:bold;}thead th{background-color:#ebebeb;width:25%;}#details-right th{width:20%;}table tr.alt td,table tr.alt th{}.highlight-code{color:#CC0000;font-weight:bold;font-style:italic;}.clear{clear:both;}.preferred{padding:0 5px 2px 5px;font-weight:normal;background:#006633;color:#FFF;font-size:.8em;}--></style>
</head><body><div id="content"><div class="content-container"><h3>HTTP Error 404.0 - Not Found</h3><h4>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.</h4></div><div class="content-container"><fieldset><h4>Most likely causes:</h4><ul>  <li>The directory or file specified does not exist on the Web server.</li>  <li>The URL contains a typographical error.</li>    <li>A custom filter or module, such as URLScan, restricts access to the file.</li> </ul></fieldset></div><div class="content-container"><fieldset><h4>Things you can try:</h4><ul>  <li>Create the content on the Web server.</li>  <li>Review the browser URL.</li>    <li>Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul></fieldset></div>
<div class="content-container"><fieldset><h4>Detailed Error Information:</h4><div id="details-left"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;ManagedPipelineHandler</td></tr><tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr><tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;svc-Integrated-4.0</td></tr><tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr>
</table></div><div id="details-right"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://tGroupPUSRER:80/rer.svc</td></tr><tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;D:\home\site\wwwroot\rer.svc</td></tr><tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr><tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>
</table><div class="clear"></div></div></fieldset></div>
<div class="content-container"><fieldset><h4>More Information:</h4>This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.<p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=404,0,0x00000000,14393">View more information &raquo;</a></p><p>Microsoft Knowledge Base Articles:</p>

</fieldset></div></div></body></html>
2020-02-03 21:45:22 tGROUPPUSRER POST /rer.svc X-ARR-LOG-ID=666b6779-fca6-4a90-8e94-9c695780dae4 443 - 40.108.180.36 - - - tgrouppusrer.azurewebsites.net 404 0 0 372 8227 19
2020-02-03 21:45:22 tGROUPPUSRER POST /rer.svc X-ARR-LOG-ID=42637d01-4bdb-4345-843b-89713a935aa2 443 - 40.108.180.36 - - - tgrouppusrer.azurewebsites.net 404 0 0 372 8455 19
2020-02-03 21:45:33 tGROUPPUSRER POST /rer.svc X-ARR-LOG-ID=8696a37b-6881-4eb1-9110-701d4bddaeb5 443 - 40.108.180.145 - - - tgrouppusrer.azurewebsites.net 404 0 0 372 8187 46
2020-02-03 21:45:33 tGROUPPUSRER POST /rer.svc X-ARR-LOG-ID=8779cafe-fbc4-4094-9ff4-9fa10b884875 443 - 40.108.180.145 - - - tgrouppusrer.azurewebsites.net 404 0 0 372 8415 21
2020-02-03 21:45:43 ~1tGROUPPUSRER GET /api/commandstream/ping shell=CMD&_=1580765141131&X-ARR-LOG-ID=d4e5e91c-1062-44d4-9e94-e93cf6911357 443 - 165.225.80.94 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 ARRAffinity=e8228ec522d0bb0cde1261622aaf3fb9855105fb7485023fe847aa1a3a4e8100 https://tgrouppusrer.scm.azurewebsites.net/DebugConsole tgrouppusrer.scm.azurewebsites.net 200 0 0 513 1582 0
2020-02-03 21:45:43 ~1tGROUPPUSRER GET /api/filesystemhub/ping _=1580765141130&X-ARR-LOG-ID=7e168704-35a9-4d2f-a4f9-b9e6f702a7ff 443 - 165.225.80.94 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 ARRAffinity=e8228ec522d0bb0cde1261622aaf3fb9855105fb7485023fe847aa1a3a4e8100 https://tgrouppusrer.scm.azurewebsites.net/DebugConsole tgrouppusrer.scm.azurewebsites.net 200 0 0 513 1552 0<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>IIS Detailed Error - 404.0 - Not Found</title><style type="text/css"><!--body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}.config_source code{font-size:.8em;color:#000000;}pre{margin:0;font-size:1.4em;word-wrap:break-word;}ul,ol{margin:10px 0 10px 5px;}ul.first,ol.first{margin-}fieldset{padding:0 15px 10px 15px;word-break:break-all;}.summary-container fieldset{padding-bottom:5px;margin-}legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;}legend{color:#333333;;margin:4px 0 8px -12px;_margin-font-weight:bold;font-size:1em;}a:link,a:visited{color:#007EFF;font-weight:bold;}a:hover{text-decoration:none;}h1{font-size:2.4em;margin:0;color:#FFF;}h2{font-size:1.7em;margin:0;color:#CC0000;}h3{font-size:1.4em;margin:10px 0 0 0;color:#CC0000;}h4{font-size:1.2em;margin:10px 0 5px 0;}#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS",Verdana,sans-serif;color:#FFF;background-color:#5C87B2;}#content{margin:0 0 0 2%;;}.summary-container,.content-container{background:#FFF;width:96%;margin-padding:10px;;}.content-container p{margin:0 0 10px 0;}#details-left{width:35%;float:left;margin-right:2%;}#details-right{width:63%;float:left;}#server_version{width:96%;_height:1px;min-height:1px;margin:0 0 5px 0;padding:11px 2% 8px 2%;color:#FFFFFF;background-color:#5A7FA5;border-bottom:1px solid #C1CFDD;border-font-weight:normal;font-size:1em;color:#FFF;text-align:right;}#server_version p{margin:5px 0;}table{margin:4px 0 4px 0;width:100%;border:none;}td,th{vertical-align:top;padding:3px 0;text-align:left;font-weight:normal;border:none;}th{width:30%;text-align:right;padding-right:2%;font-weight:bold;}thead th{background-color:#ebebeb;width:25%;}#details-right th{width:20%;}table tr.alt td,table tr.alt th{}.highlight-code{color:#CC0000;font-weight:bold;font-style:italic;}.clear{clear:both;}.preferred{padding:0 5px 2px 5px;font-weight:normal;background:#006633;color:#FFF;font-size:.8em;}--></style>
</head><body><div id="content"><div class="content-container"><h3>HTTP Error 404.0 - Not Found</h3><h4>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.</h4></div><div class="content-container"><fieldset><h4>Most likely causes:</h4><ul>  <li>The directory or file specified does not exist on the Web server.</li>  <li>The URL contains a typographical error.</li>    <li>A custom filter or module, such as URLScan, restricts access to the file.</li> </ul></fieldset></div><div class="content-container"><fieldset><h4>Things you can try:</h4><ul>  <li>Create the content on the Web server.</li>  <li>Review the browser URL.</li>    <li>Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul></fieldset></div>
<div class="content-container"><fieldset><h4>Detailed Error Information:</h4><div id="details-left"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;ManagedPipelineHandler</td></tr><tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr><tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;svc-Integrated-4.0</td></tr><tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr>
</table></div><div id="details-right"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://tGroupPUSRER:80/rer.svc</td></tr><tr><th>Physical Path<
基于这篇堆栈溢出文章,我修改了我的web.config,如下所示:-

<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <appSettings file="custom.config">
    <add key="ClientId" value="****" />
    <add key="ClientSecret" value="****" />
  </appSettings>
  <system.web>
    <customErrors mode="Off"/>
  </system.web>
</configuration>
<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>

  <system.serviceModel>
    <services>
      <service name="TGroupPUSRER.RER">
        <endpoint
        address="/rer.svc"
        binding="webHttpBinding"
        contract="Microsoft.SharePoint.Client.EventReceivers.IRemoteEventService"
/>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <protocolMapping>
      <remove scheme="http"/>
      <add binding="basicHttpBinding" scheme="https" bindingConfiguration="secureBinding" />
    </protocolMapping>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior >
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <appSettings file="custom.config">
    <add key="ClientId" value="***" />
    <add key="ClientSecret" value="***" />
  </appSettings>
</configuration>

但是我仍然在azure日志中发现文件未找到错误。

在步骤6中,您显示以“http”开头的目标URL

相反,它应该以“https”开头,以反映您正在使用的其他设置

老实说,我甚至不能真正地认为这是一个答案,但可能是这么简单。


此外,在第3步中,重定向URL中有一个尾随斜杠,但示例中没有尾随斜杠,因此我也将其删除。

您能分享您在
appregnew.aspx
上的内容吗?特别是
App-Domain
Redirect-URI
上的页面?@ChunLiu感谢您的回复。我用第2点和第2点的两个屏幕截图更新了这个问题,其中显示了
appregnew.aspx
。@ChunLiu我提供的信息对您来说有效吗?如果不进行调试,很难看出有什么问题。也许你可以尝试从头开始学习其他一些在线教程,如或。你是否遵循了步骤7中提供的说明?在azure web应用程序中,我获得了“获取发布配置文件”,在此配置文件中,我复制/粘贴了ftp设置。在目标URL中,使用http而不是https指定它。。。
<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>

  <system.serviceModel>
    <services>
      <service name="TGroupPUSRER.RER">
        <endpoint
        address="/rer.svc"
        binding="webHttpBinding"
        contract="Microsoft.SharePoint.Client.EventReceivers.IRemoteEventService"
/>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <protocolMapping>
      <remove scheme="http"/>
      <add binding="basicHttpBinding" scheme="https" bindingConfiguration="secureBinding" />
    </protocolMapping>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior >
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <appSettings file="custom.config">
    <add key="ClientId" value="***" />
    <add key="ClientSecret" value="***" />
  </appSettings>
</configuration>