简体   繁体   English

如何使用NET Core 2.1.1修复BIM 360的内部服务器错误

[英]How to fix Internal Server Error for BIM 360 using NET Core 2.1.1

I am trying to copy Companies inside BIM 360 from one account (Source) to another account (Target). 我正在尝试将BIM 360内的Companies从一个帐户(源)复制到另一帐户(目标)。 The following code creates a Company inside of the Target account with the same properties as the Source account. 以下代码在目标帐户内创建一个公司,该公司具有与源帐户相同的属性。

dynamic createdTargetCompany = await Autodesk.Forge.Client.Configuration.Default.ApiClient.CallApiAsync(
        "https://developer.api.autodesk.com/hq/v1/accounts/" + targetAccountId + "/companies",
        Method.POST,
        new Dictionary<string, string>(),
        Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
        targetHeaderParams,
        new Dictionary<string, string>(),
        new Dictionary<string, FileParameter>(),
        new Dictionary<string, string>(),
        "application/json");

The createdTargetCompany variable contains status code InterServerError with the following message: createdTargetCompany变量包含状态代码InterServerError以及以下消息:

"{\\"code\\":2000,\\"message\\":\\"ERROR: duplicate key value violates unique constraint \\\\"companies_pkey\\\\"\\nDETAIL: Key (id)=(15bf4765-73b8-4940-aec4-0bcbeeec2bae) already exists.\\n\\"}" “ {\\” code \\“:2000,\\” message \\“:\\”错误:重复的键值违反了唯一约束\\\\“ companies_pkey \\\\” \\ nDETAIL:键(id)=(15bf4765-73b8-4940-aec4- 0bcbeeec2bae)已经存在。\\ n \\“}”

I am unsure what the DETAIL: Key (id) is. 我不确定DETAIL: Key (id)是什么。 Any ideas what's causing this and how to fix it? 有什么想法会导致此问题以及如何解决?

From the code I posted in the question above, the Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"), method now no longer gets the Source's Account Id and Company Id. 从我在上述问题中发布的代码, Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),方法现在不再获取源的帐户ID和公司ID。 Removing this feature now creates the Companies in the Target account. 现在,删除此功能将在目标帐户中创建公司。

Many thanks to the comments posted regarding this issue. 非常感谢就此问题发表的评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用TestServer和Antiforgery修复POST集成测试中的500 Internal Server Error? ASP.NET核心 - How to fix 500 Internal Server Error for POST integration tests using TestServer and Antiforgery? ASP.NET Core 使用 .NET 将图像上传到 BIM 360 项目 - Uploading an image to a BIM 360 project using .NET 如果使用Solr.NET将.NET Core与Solr连接,如何解决“远程服务器返回错误:(404)未找到”的问题 - How to fix “The remote server returned an error: (404) Not Found” if connecting .NET Core with Solr using Solr.NET Web 应用程序使用 c#.net Core 内部服务器错误 500 - Web application using c#.net Core internal server error 500 邮递员-如何使用V2端点将用户导入BIM 360项目 - Postman - How to Import Users to a BIM 360 Project Using the V2 Endpoint RestSharp 在 ASP.NET Core 3.1 中导致内部服务器错误 - RestSharp causes internal server error in ASP.NET Core 3.1 ASP.NET Core Web API 500内部服务器错误 - ASP.NET Core Web API 500 Internal Server Error .Net Core 2.0内部服务器错误,Redis缓存 - .Net Core 2.0 Internal Server Error with Redis Cache 在IIS上托管Net Core 2.0应用程序会出现内部服务器错误 - Hosting net core 2.0 app on iis gives internal server error JWT OpenIddict和ASP.Net Core 500内部服务器错误 - JWT OpenIddict and ASP.Net Core 500 Internal Server Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM