I know this question has been posed several times and I have read the solutions and watched the instructional video provided but it is still not working for me. I must be missing something and am hoping someone can point it out. Works fine in development when everything is on my machine but when I move the Reporting Service to the server and launch my Angular project with a service url pointing to the Reporting Service on the server, it gives the following error:
Error loading the report viewer's templates. (Template = http://myhost/ReportingSample/api/reports/resources/templates/telerikReportViewerTemplate-html).
and this error in the console: Origin http://localhost:4200 not found in Access-Control-Allow-Origin header. (along with other CORS related errors).
I have the following in my Global.asax.vb:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)<
br
> System.Web.Http.GlobalConfiguration.Configuration.EnableCors<
br
> Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(System.Web.Http.GlobalConfiguration.Configuration)<
br
> ' Fires when the application is started<
br
> End Sub
Controller:
Namespace Controllers<
br
> <
br
> <
EnableCors
("*", "*", "*", "*")><
br
> Public Class ReportsController<
br
> Inherits ReportsControllerBase<
br
> Shared configurationInstance As Telerik.Reporting.Services.ReportServiceConfiguration...
Web.config:
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Newtonsoft.Json"
publicKeyToken
=
"30ad4fe6b2a6aeed"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-11.0.0.0"
newVersion
=
"11.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Http"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-5.2.6.0"
newVersion
=
"5.2.6.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Net.Http.Formatting"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-5.2.6.0"
newVersion
=
"5.2.6.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"DocumentFormat.OpenXml"
publicKeyToken
=
"8fb06cb64d019a17"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.8.1.0"
newVersion
=
"2.8.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Net.Http"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.1.1.0"
newVersion
=
"4.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Diagnostics.DiagnosticSource"
publicKeyToken
=
"cc7b13ffcd2ddd51"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.1.0"
newVersion
=
"4.0.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Net.Http"
culture
=
"neutral"
publicKeyToken
=
"31BF3856AD364E35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-65535.65535.65535.65535"
newVersion
=
"4.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Net.Http.WebRequest"
culture
=
"neutral"
publicKeyToken
=
"31BF3856AD364E35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-65535.65535.65535.65535"
newVersion
=
"4.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Net.Http.Formatting"
culture
=
"neutral"
publicKeyToken
=
"31BF3856AD364E35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-65535.65535.65535.65535"
newVersion
=
"5.2.6.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Http"
culture
=
"neutral"
publicKeyToken
=
"31BF3856AD364E35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-65535.65535.65535.65535"
newVersion
=
"5.2.6.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Http.WebHost"
culture
=
"neutral"
publicKeyToken
=
"31BF3856AD364E35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-65535.65535.65535.65535"
newVersion
=
"5.2.6.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
system.webServer
>
<
handlers
>
<
remove
name
=
"ExtensionlessUrlHandler-ISAPI-4.0_32bit"
/>
<
remove
name
=
"ExtensionlessUrlHandler-ISAPI-4.0_64bit"
/>
<
remove
name
=
"ExtensionlessUrlHandler-Integrated-4.0"
/>
<
add
name
=
"ExtensionlessUrlHandler-ISAPI-4.0_32bit"
path
=
"*."
verb
=
"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
modules
=
"IsapiModule"
scriptProcessor
=
"%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition
=
"classicMode,runtimeVersionv4.0,bitness32"
responseBufferLimit
=
"0"
/>
<
add
name
=
"ExtensionlessUrlHandler-ISAPI-4.0_64bit"
path
=
"*."
verb
=
"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
modules
=
"IsapiModule"
scriptProcessor
=
"%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
preCondition
=
"classicMode,runtimeVersionv4.0,bitness64"
responseBufferLimit
=
"0"
/>
<
add
name
=
"ExtensionlessUrlHandler-Integrated-4.0"
path
=
"*."
verb
=
"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
type
=
"System.Web.Handlers.TransferRequestHandler"
preCondition
=
"integratedMode,runtimeVersionv4.0"
/>
</
handlers
>
</
system.webServer
>