Tôi đã tìm thấy điều này sau rất nhiều tìm kiếm và dành rất nhiều thời gian cho điều này trong VS 2014
- Tạo
Database ProjectĐược gọi là "CLR_Test" - Tạo
LibraryĐối với ứng dụng WCF "CLR_Service_Client" -
Thêm
Serivce Refrencecủa dịch vụ wcf thành "CLR_Test", sau đó thêm tham chiếu của "CLR_Service_Client" vào "CLR_Test"
4.Bạn phải thay đổi Tùy chọn DB để có thể chạy các hội đồng không an toàn với mã dưới đâyALTER DATABASE SaleAutomation SET TRUSTWORTHY ON RECONFIGURE -
Trong "CLR_Test"
Project PropertiestrongSQLCLRbộ tabPermission levelthànhUnsafe(Có một cách khác là sau khi xuất bản dự án, bạn thay đổi cấp độ của nó từ quản lý máy chủ sql và một cách khác là bạn thêm cấp độ quyền vào tập lệnh xuất bản, bạn có thể sử dụng từng cấp độ trong số chúng,
nhưng bạn phải lưu ý rằng nếu bạn sử dụng từproject propertieschỉ dự án "CLR_Test" tự động tạoUnsafevà bạn phải sử dụng các cách khác để đặt "CLR_Service_Client"Unsafe)
6. Chạy Tập lệnh này để thêm Sqlserver có thể chạy dịch vụ wcf
CREATE ASSEMBLY
SMDiagnostics from
'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMDiagnostics.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY
[System.Messaging] from
'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY
[System.IdentityModel] from
'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY
[System.IdentityModel.Selectors] from
'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.Selectors.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY -- this will add service modal
[Microsoft.Transactions.Bridge] from
'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\Microsoft.Transactions.Bridge.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY -- this will add service modal
[System.Runtime.Serialization] from
'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\System.Runtime.Serialization.dll'
with permission_set = UNSAFE
GO
CREATE ASSEMBLY -- this will add service modal
[System.ServiceModel] from
'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\System.ServiceModel.dll'
with permission_set = UNSAFE
GO
- bây giờ bạn xuất bản dự án của mình và chạy quy trình đã lưu trữ và tận hưởng.