I am working on a razor pages project that needs to view IFC files, so I converted the IFC file into Wexbim files to use the XbimWebUi library.
My problem is when I use the Wexbim file from wwwroot I get this error "Uncaught Failed to fetch binary data from the server. Server code: 404. This might be due to the CORS policy of your browser if you run this as a local file.", so I uploaded my file to Cloudinary website and got a link for it and it works well.
My question is how to do this throughout wwwroot folder without using an external link.
Thanks in advance.
My Code
<html>
<head>
<title>xViewer</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script src="~/Viewer/gl-matrix.js"></script>
<script src="~/Viewer/jquery.js"></script>
<script src="~/Viewer/webgl-utils.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-product-type.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-state.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-shaders.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-model-geometry.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-model-handle.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-binary-reader.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-triangulated-shape.debug.js"></script>
<script type="text/javascript" src="~/Viewer/xbim-viewer.debug.js"></script>
<style>
html, body {
height: 100%;
padding: 0;
margin: 0;
}
canvas {
display: block;
border: none;
margin-left: auto;
margin-right: auto;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="content">
<canvas id="viewer"></canvas>
<script type="text/javascript">
var viewer = new xViewer('viewer');
/*viewer.load("~/Uploads/SampleHouse.wexBIM");*/
viewer.load("https://res.cloudinary.com/amostafah/raw/upload/v1623564775/SampleHouse_uacu4j.wexbim");
viewer.start();
</script>
</div>
</body>
</html>